PixarAnimationStudios / ruby-jss

ruby-jss provides native ruby access to the REST APIs of Jamf Pro, an enterprise/education tool for managing Apple devices, from jamf.com. The Jamf module provides access to both APIs. Jamf Pro objects are implemented as classes and interact with each other. Authentication tokens, data format and other details are handled under the hood to allow simpler, intuitive automation of Jamf-related tasks.
http://pixaranimationstudios.github.io/jss-api-gem/index.html
Other
98 stars 28 forks source link

JSS connection started failing - JSSUnsupportedVersion #18

Closed HIMANSHU-ELIGIBLE closed 7 years ago

HIMANSHU-ELIGIBLE commented 7 years ago

JSS API connection has started failing since last 2 days for me. Talked to jamf support regarding it and they said they have updated servers over weekend when we started seeing this issue. Pasting the error below -


2.2.3 :001 > require 'ruby-jss' => false 2.2.3 :002 > JSS::API.connect(user: "himanshu", pw: :prompt, server: 'eligible.jamfcloud.com', port:443) Enter the password for JSS user himanshu@eligible.jamfcloud.com: JSS::UnsupportedError: Your JSS Server version, 9.100.0-t1499435238, is to low. Must be 9.4 or higher. from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/ruby-jss-0.7.0/lib/jss/api_connection.rb:231:in connect' from (irb):2 from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:instart' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:in start' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:inconsole' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in run_command!' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in<top (required)>' from bin/rails:4:in require' from bin/rails:4:in
'

Also jamf support confirmed that "9.100.0-t1499435238" is latest version while 9.4 is old one.

Thanks Himanshu

glenfarclas17 commented 7 years ago

Hi Himanshu

This problem was resolved in ruby-jss version 0.9.2. Please update your copy of the gem. If you installed it with rubygems, you can update it with gem update ruby-jss.

Feel free to reach out again if you still have problems. Cheers! -Chris

HIMANSHU-ELIGIBLE commented 7 years ago

Thanks for response @glenfarclas17

I updated the version but still not able to connect. Keep getting error "Connection reset by peer"


2.2.3 :001 > require 'ruby-jss' => false 2.2.3 :002 > JSS::API.connect(user: "himanshu", pw: :prompt, server: 'eligible.jamfcloud.com', port:443) Enter the password for JSS user himanshu@eligible.jamfcloud.com: Errno::ECONNRESET: Connection reset by peer from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in read_nonblock' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:inrbuf_fill' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/protocol.rb:134:in readuntil' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/protocol.rb:144:inreadline' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http/response.rb:39:in read_status_line' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http/response.rb:28:inread_new' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http.rb:1414:in block in transport_request' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http.rb:1411:incatch' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in transport_request' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http.rb:1384:inrequest' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/rest-client-1.8.0/lib/restclient/request.rb:270:in net_http_do_request' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/rest-client-1.8.0/lib/restclient/request.rb:418:inblock in transmit' from /Users/Himanshu/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http.rb:853:in start' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/rest-client-1.8.0/lib/restclient/request.rb:413:intransmit' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in execute' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/rest-client-1.8.0/lib/restclient/request.rb:41:inexecute' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/rest-client-1.8.0/lib/restclient/resource.rb:51:in get' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/ruby-jss-0.9.2/lib/jss/api_connection.rb:383:inget_rsrc' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/ruby-jss-0.9.2/lib/jss/api_connection.rb:599:in verify_server_version' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/ruby-jss-0.9.2/lib/jss/api_connection.rb:315:inconnect' from (irb):2 from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:in start' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:instart' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:in console' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:inrun_command!' from /Users/Himanshu/.rvm/gems/ruby-2.2.3/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in <top (required)>' from bin/rails:4:inrequire'

Thanks Himanshu

glenfarclas17 commented 7 years ago

Ahh - I think you've hit another bug, which was introduced more recently, for which the fix is coming, but not there yet. If you connect on port 443 (rather than the JSS default 8443) ruby-jss doesn't assume SSL is needed. Try adding use_ssl: true to your API connection parameters.

I"ll be making ruby-jss assume SSL on port 443 in the next release. Sorry bout that! -Chris

glenfarclas17 commented 7 years ago

Actually I just pushed that fix as a pre-release v0.10.0a1, and its in rubygems.org too. You're welcome to try it out, but beware: there are a lot of other APIConnection changes in that release that need more testing before I call it good.