JIRA-Ruby_ scheduler捕获异常:JIRA :: HTTPError

问题描述 投票:0回答:1

我正在用潇洒和jira-ruby来监控我的jira bug。我发现这个widget但我有一个错误,当我开始潇洒。

这里的错误:

scheduler caught exception:   
JIRA::HTTPError
    /Users/users/.rvm/gems/ruby-2.2.4/gems/jira-ruby-1.1.3/lib/jira/request_client.rb:16:in `request'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/jira-ruby-1.1.3/lib/jira/client.rb:213:in `request'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/jira-ruby-1.1.3/lib/jira/client.rb:191:in `get'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/jira-ruby-1.1.3/lib/jira/resource/issue.rb:64:in `jql'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/jira-ruby-1.1.3/lib/jira/base_factory.rb:33:in `block (2 levels) in delegate_to_target_class'
    /Users/users/../../jobs/jira_number_of_issues_in_filter.rb:35:in `block (2 levels) in <top (required)>'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `call'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `trigger_block'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in `block in trigger'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `call'
    /Users/users/.rvm/gems/ruby-2.2.4/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `block in trigger_job'

这是我的ruby脚本的副本:

require 'jira-ruby'

JIRA_PROPS = {
  'url' => URI.parse("https://SSSSS/test"),
  'username' => 'user',
  'password' => 'passwd',
  'proxy_address' => nil,
  'proxy_port' => nil
}

# the key of this mapping must be a unique identifier for your jql filter, the according value must be the jql filter id or filter name that is used in Jira
filter_mapping = {
  'filter1' => { :filter => 'aaaa' }
}

jira_options = {
  :username => JIRA_PROPS['username'],
  :password => JIRA_PROPS['password'],
  :context_path => JIRA_PROPS['url'].path,
  :site => JIRA_PROPS['url'].scheme + "://" + JIRA_PROPS['url'].host,
  :auth_type => :basic,
  :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
  :use_ssl => JIRA_PROPS['url'].scheme == 'https' ? true : false,
  :proxy_address => JIRA_PROPS['proxy_address'],
  :proxy_port => JIRA_PROPS['proxy_port']
}

last_issues = Hash.new(0)

filter_mapping.each do |filter_data_id, filter|
  SCHEDULER.every '10s', :first_in => 0 do |job|
    last_number_issues = last_issues['filter_data_id']
    client = JIRA::Client.new(jira_options)
    puts client.Issue
    //next line is the 35, where the error comes
    current_number_issues = client.Issue.jql("filter in (\"#{filter[:filter]}\")").size <-- line 35
    last_issues['filter_data_id'] = current_number_issues
    send_event(filter_data_id, { current: current_number_issues, last: last_number_issues})
  end
end

我刚刚在我的Gemfile中添加了gem'jira-ruby'。

关于这个问题的任何想法。

ruby rubygems jira-rest-api dashing
1个回答
0
投票

我会尝试将您的URL直接移动到jira_options值中的网站定义。

:site => 'http://jira.company.com:8080', 

还可以尝试在划线之外测试JIRA-ruby库以确定您的连接设置。

根据我的经验,使用直接/非代理URL效果更好。因人而异。

© www.soinside.com 2019 - 2024. All rights reserved.