Atalanta / cucumber-chef

Framework for test-driven infrastructure development
http://cucumber-chef.org
Apache License 2.0
265 stars 55 forks source link

Small fail, with a workaround #114

Closed pikesley closed 11 years ago

pikesley commented 11 years ago

Span up my first proper cc 3 test-lab. Yay!

Tried to run some tests, got this:

<lots o' cookbooks snipped>
Uploading yumrepo      [0.16.6]
========[ STDERR ]========[ sam@ ]========[ STDERR ]========
ERROR: Network Error: getaddrinfo: nodename nor servname provided, or not known
/Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/net/http.rb:762:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError)
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/net/http.rb:762:in `open'
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/net/http.rb:762:in `connect'
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
        from /Users/sam/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/net/http.rb:744:in `start'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:142:in `block in uploader_function_for'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:25:in `call'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:25:in `block (3 levels) in setup_worker_threads'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:24:in `loop'
        from /Users/sam/.rvm/gems/ruby-1.9.3-p362@cc3/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:24:in `block (2 levels) in setup_worker_threads'

"This looks familiar", I thought. Ah yes, I saw this when building our new Chef 11 server. Which means I know how to fix it. So as per this (from this), I made an /etc/chef-server/chef-server.rb file, thus:

server_name = "192.168.33.10"
api_fqdn server_name

nginx['url'] = "https://#{server_name}"
nginx['server_name'] = server_name
lb['fqdn'] = server_name
bookshelf['vip'] = server_name

and ran sudo chef-server-ctl reconfigure, and now it works.

Not sure if I've missed (or misunderstood) something and this is working out-the-box for other people, but whatever, I've just run my first cucumber-chef 3 test suite and I'm a VERY HAPPY SAM!

zpatten commented 11 years ago

Awesome information; thank you for this! I'll work on applying this to the setup task and get a fix out by EOD.

zpatten commented 11 years ago

FWIW; I don't think you missed anything; I thought I had the Chef 11.x bootstrap working solid. I had hit an issue that must of been caused by the lack of the chef-server.rb, but it appeared to have resolved itself to me; in retrospect I must of just ended up masking the problem somehow.

pikesley commented 11 years ago

It might be worth noting that the /etc/chef-server/chef-server.rb file does exist when the lab first comes up, but it looks like this:

# AUTO-GENERATED BY CHEF - DO NOT MODIFY

topology "standalone"

api_fqdn "cucumber-chef.test-lab"
zpatten commented 11 years ago

Ya that's definitely missing some bits. I'm guessing this is a result of me, ineffectively, trying to force the chef-server FQDN to the IP and not the default cucumber-chef.test-lab FQDN from the test lab host. Originally it kept trying to redirect me over to https://cucumber-chef.test-lab (as it should of) which would not resolve (and I don't want people having to edit their hosts files to make this work).

I'll refactor the setup/bootstrap to ensure we end up using a configuration like the one you've supplied.

zpatten commented 11 years ago

Seems I'm not overriding properly; these are the current (v3.0.3) attributes passed to the Chef 11.x chef-solo bootstrap run:

        {
          "chef-server" => {
            "nginx" => {
              "enable_non_ssl" => true,
              "server_name" => "localhost",
              "url" => "http://localhost"
            },
            "chef_server_webui" => {
              "enable" => true
            }
          },
          "run_list" => %w(recipe[chef-server::default] role[test_lab])
        }
zpatten commented 11 years ago

OK I've released v3.0.4; this should be resolved now.

pikesley commented 11 years ago

w00t! It works! That's another beer I owe you ;)

zpatten commented 11 years ago

Closing this out since it's been resolved.