infochimps-labs/ironfan

Vanilla ironfan-homebase / example-credentials breaks berks upload

rberger opened this issue · 0 comments

If I do a fresh clone of ironfan-homebase with no changes to knife/knife.rb and the credentials are purely based on the minimal modification of example-credentials, Berkshelf does not pick up the chef_server_url and defaults to trying to connect to localhost.

Uploading ant (0.10.11) to: 'http://localhost:4000/'
E, [2013-10-08T20:07:25.453514 #64519] ERROR -- : Ridley::Connection crashed!
Faraday::Error::ConnectionFailed: connection refused: localhost:4000
...

But if I move a fully specified definition of chef_server_url to before any of the more fancy loading of stuff in the knife file as in:

bootstrap_chef_version  "~> 0.10.4"

chef_server_url "https://api.opscode.com/organizations/stapleslabs"

#
# Keys for git deploys
#
git_key_files = Dir.glob("#{credentials_path}/git_keys/*.pem")
Chef::Config[:git_keys] = git_key_files.inject({}) do |hsh, file|
  hsh[ File.basename(file, '.pem').to_sym ] = File.read(file)
  hsh
end

Berks upload works fine.

Note that knife commands work fine if I have the vanilla knife.rb setup. Its just berks upload that doesn't work.

I also had to bump the version of berkshelf to be > 1.4.2 (actually set it to ~> 1.4.2) in the Gemfile in ironfan-homebase. This forces the ridley version to be passed the versions that have a bug that breaks the upload of some cookbooks with the error:

Uploading ant (0.10.11) to: 'https://api.opscode.com:443/organizations/stapleslabs'
E, [2013-10-08T21:13:34.629037 #65409] ERROR -- : Ridley::Errors::HTTPBadRequest: {"error":["Field 'metadata.name' invalid"]}
E, [2013-10-08T21:13:34.629199 #65409] ERROR -- : /Users/rberger/.rvm/gems/ruby-1.9.3-p429/gems/ridley-0.9.1/lib/ridley/middleware/chef_response.rb:25:in `on_complete'