RallyTools / RallyRestToolkitForRuby

A toolkit wrapping Rally's REST webservice for Ruby
MIT License
47 stars 32 forks source link

Error when sending request #13

Closed jmmallon closed 11 years ago

jmmallon commented 11 years ago

Using Rally API 0.96 to do user creation & maintenance. Getting an error when I send a query for workspace info. Error recurs no matter what the call to the API.

Code: require 'rubygems' require 'rally_api' require 'pp'

$my_base_url = "https://rally1.rallydev.com/slm" $my_username = "XXXX"; $my_password = "XXXX";

$headers = RallyAPI::CustomHttpHeader.new() $headers.name = "Ruby User Management Tool 2" $headers.vendor = "Rally Labs" $headers.version = "0.10"

API Version

$wsapi_version = "1.40"

config = {:base_url => $my_base_url} config[:username] = $my_username config[:password] = $my_password config[:headers] = $my_headers #from RallyAPI::CustomHttpHeader.new() config[:version] = $wsapi_version

@rally = RallyAPI::RallyRestJson.new(config)

subscription_query = RallyAPI::RallyQuery.new() subscription_query.type = :subscription subscription_query.fetch = "Name,SubscriptionID,Workspaces,Name,State,ObjectID" subscription_query.page_size = 200 #optional - default is 200 subscription_query.limit = 50000 #optional - default is 99999 subscription_query.order = "Name Asc"

results = @rally.find(subscription_query)

p results


Error: /usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_json_connection.rb:111:in send_request': RallyAPI: - rescued exception - undefined methodssl_version=' for #OpenSSL::SSL::SSLContext:0x40232734 on request to https://rally1.rallydev.com/slm/webservice/1.40/subscription.js with params projectScopeDownfalsepagesize200start1orderName AscfetchName,SubscriptionID,Workspaces,Name,State,ObjectIDqueryprojectScopeUpfalse (StandardError) from /usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_json_connection.rb:67:in get_all_json_results' from /usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_rest_json.rb:237:infind' from a.rb:33

Also got these warnings: /usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_object.rb:168: warning: parenthesize argument(s) for future version

/usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_rest_json.rb:429: warning: don't put space before argument parentheses

markwilliams970 commented 11 years ago

I just discovered a very similar issue today as well. Are you running the code as a Workspace Admin? If so then this may be the same bug that I found in the server-side Webservices API whereby Workspace Admins do not have the needed permissions to query the Subscription object (they should). A Defect has been filed against Webservices API for this issue. A temporary workaround would be to run the code as Subscription Administrator. If the issue is something different, let us know and we'll take a deeper look.

jmmallon commented 11 years ago

I am running as a Workplace Admin. I’ve gotten the error even when querying on projects.

Joe Mallon, Member Of Technical Staff, Wind River direct 510-749-2094 fax 510-749-4550

From: markwilliams970 [mailto:notifications@github.com] Sent: Friday, March 29, 2013 3:41 PM To: RallyTools/RallyRestToolkitForRuby Cc: Mallon, Joe Subject: Re: [RallyRestToolkitForRuby] Error when sending request (#13)

I just discovered a very similar issue today as well. Are you running the code as a Workspace Admin? If so then this may be the same bug that I found in the server-side Webservices API whereby Workspace Admins do not have the needed permissions to query the Subscription object (they should). A Defect has been filed against Webservices API for this issue. A temporary workaround would be to run the code as Subscription Administrator. If the issue is something different, let us know and we'll take a deeper look.

— Reply to this email directly or view it on GitHubhttps://github.com/RallyTools/RallyRestToolkitForRuby/issues/13#issuecomment-15664098.

markwilliams970 commented 11 years ago

Try your code again now. Somewhat inexplicably, in my immediate testing now, I can no longer reproduce the WSAPI query permissions problem when running as a Workspace Administrator.

jmmallon commented 11 years ago

Still getting RallyAPI: - rescued exception - undefined method `ssl_version=' for #OpenSSL::SSL::SSLContext:0x40232734

Joe Mallon, Member Of Technical Staff, Wind River direct 510-749-2094 fax 510-749-4550

From: markwilliams970 [mailto:notifications@github.com] Sent: Friday, March 29, 2013 4:02 PM To: RallyTools/RallyRestToolkitForRuby Cc: Mallon, Joe Subject: Re: [RallyRestToolkitForRuby] Error when sending request (#13)

Try your code again now. Somewhat inexplicably, in my immediate testing now, I can no longer reproduce the WSAPI query permissions problem when running as a Workspace Administrator.

— Reply to this email directly or view it on GitHubhttps://github.com/RallyTools/RallyRestToolkitForRuby/issues/13#issuecomment-15664727.

markwilliams970 commented 11 years ago

Does it make any change if you update your base url to be https://us1.rallydev.com/slm ?

jmmallon commented 11 years ago

Nope. Here’s the full error again, just in case it’s useful:

/usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_json_connection.rb:111:in send_request': RallyAPI: - rescued exception - undefined methodssl_version=' for #OpenSSL::SSL::SSLContext:0x40232734 on request to https://us1.rallydev.com/slm/webservice/1.40/project.js with params pagesize200start1orderName AscfetchName,State,ObjectIDprojectScopeUpfalsequeryprojectScopeDownfalse (StandardError) from /usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_json_connection.rb:67:in get_all_json_results' from /usr/local/lib/ruby/gems/1.8/gems/rally_api-0.9.6/lib/rally_api/rally_rest_json.rb:237:infind'

Joe Mallon, Member Of Technical Staff, Wind River direct 510-749-2094 fax 510-749-4550

markwilliams970 commented 11 years ago

Weird. Has the code run successfully in the past? With previous versions of rally_api? It's possible this could be an OpenSSL versioning/compatibility issue. What OS (32bit, 64bit) and Ruby version (ruby -v)?

jmmallon commented 11 years ago

Never worked – first attempt at using new rally API. Linux ala-engtools-test 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:39:47 EDT 2008 i686 i686 i386 GNU/Linux ruby 1.8.6 (2010-09-02 patchlevel 420) [i686-linux]

Joe Mallon, Member Of Technical Staff, Wind River direct 510-749-2094 fax 510-749-4550

markwilliams970 commented 11 years ago

Ah - rally_api require Ruby 1.9.2 or above. I know RHEL comes with 1.8.x standard but it should be possible to build a compatible 1.9.x from source and pair it with Ruby version manager to get a compatible ruby environment on your linux system.

jmmallon commented 11 years ago

I upgraded my version of Ruby and the error has disappeared. Thanks for your help!

markwilliams970 commented 11 years ago

Glad to know things are working. Will go ahead and close the Issue.