danryan / spice

A zesty Chef server API wrapper
http://documentup.com/danryan/spice
MIT License
103 stars 22 forks source link

Spice::Error::Unauthorized when using low level methods #24

Open Afterglow opened 12 years ago

Afterglow commented 12 years ago

I recently redeployed an app using the latest gems onto a new server and I have noticed that calls that use the low level Spice.get type methods fail with an apparently spurious unauthorised error.

print Spice.client('farmer') print Spice.get('clients/farmer')

Spice::Client:0x00000001b8c698

/usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/spice-1.0.4/lib/spice/response/client_error.rb:12:in on_complete': error (Spice::Error::Unauthorized) from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/faraday-0.8.4/lib/faraday/response.rb:9:inblock in call' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/faraday-0.8.4/lib/faraday/response.rb:63:in on_complete' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/faraday-0.8.4/lib/faraday/response.rb:8:incall' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/faraday-0.8.4/lib/faraday/response.rb:8:in call' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/faraday-0.8.4/lib/faraday/connection.rb:226:inrun_request' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/spice-1.0.4/lib/spice/request.rb:55:in request' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/spice-1.0.4/lib/spice/request.rb:11:inget' from /usr/local/rvm/gems/ruby-1.9.3-p286@farmer/gems/spice-1.0.4/lib/spice.rb:20:in method_missing' from ./spicetest.rb:11:in

'

* LOCAL GEMS *

actionmailer (3.2.8) actionpack (3.2.8) activemodel (3.2.8) activerecord (3.2.8) activeresource (3.2.8) activesupport (3.2.8) arel (3.0.2) builder (3.0.4) bundler (1.2.1) bunny (0.8.0) chef (10.12.0) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.4.0) erubis (2.7.0) execjs (1.4.0) faraday (0.8.4) highline (1.6.15) hike (1.2.1) i18n (0.6.1) ipaddress (0.8.0) journey (1.0.4) jquery-rails (2.1.3) json (1.6.1) libv8 (3.3.10.4 x86_64-linux) mail (2.4.4) mime-types (1.19) mixlib-authentication (1.3.0) mixlib-cli (1.2.2) mixlib-config (1.1.2) mixlib-log (1.4.1) mixlib-shellout (1.1.0) moneta (0.6.0) multi_json (1.3.6) multipart-post (1.1.5) net-ssh (2.2.2) net-ssh-gateway (1.1.0) net-ssh-multi (1.1) ohai (6.14.0) polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) rack-ssl (1.3.2) rack-test (0.6.2) rails (3.2.8) railties (3.2.8) rake (0.9.2.2) rdoc (3.12) rest-client (1.6.7) rubygems-bundler (1.1.0) rvm (1.11.3.5) sass (3.2.1) sass-rails (3.2.5) spice (1.0.4) sprockets (2.1.3) sqlite3 (1.3.6) systemu (2.5.2) therubyracer (0.10.2) thor (0.16.0) tilt (1.3.3) treetop (1.4.11) tzinfo (0.3.33) uglifier (1.3.0) uuidtools (2.1.3) yajl-ruby (1.1.0)

danryan commented 12 years ago

Howdy! I appreciate the bug report :)

Spice has a dependency on mixlib-authentication, which just recently got a big rewrite that broke backward compatibility, but was packaged as only a minor version bump.

I released spice v1.0.6 to pin down dependencies with more pessimistic version constraints. This should fix your issues. Could you kindly upgrade to spice v1.0.6, try it out, and let me know if you're still seeing the same issue?

Thanks!

Afterglow commented 11 years ago

I think this fix worked with chef 10.12 but your version constraint conflicts with 10.24.0 and the chef 11 line of gems which are asking for mixlib-authentication > 1.3.0. Though I think there are probably other issues with chef 11 as well.

danryan commented 11 years ago

@Afterglow thanks for the report! I haven't pushed a new version since Chef 11 was released. I'll work on that this weekend. Odds are it'll be a major bump and will drop support for < 10.x going forward.

Afterglow commented 11 years ago

Seems like opscode bumped mixlib-authentication to 1.3.0 in 10.14.0 so the last working chef version is 10.12.0. Seems like there are a bunch of issues with the attributes API changes as well now 11 is around. Right now we are just working around it but if I get a chance i'll try and fix some stuff