Closed drnic closed 11 years ago
did you run cucumber-chef setup? It seems like you don't have the server created yet.
$ cucumber-chef setup
A test lab already exists using the AWS credentials you supplied
Maybe the setup has not finished. Try to run
$ cucumber-chef destroy $ cucumber-chef setup
What OS image are you using?
$ cucumber-chef destroy
Destroying Server: 107.20.27.93
$ cucumber-chef setup
/Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.6.5/lib/excon/connection.rb:190:in `request': The key pair '/Users/drnic/.chef/drnic.pem' does not exist (Fog::Compute::AWS::NotFound)
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.9.0/lib/fog/core/connection.rb:20:in `request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.9.0/lib/fog/compute/aws.rb:257:in `request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.9.0/lib/fog/compute/requests/aws/run_instances.rb:108:in `run_instances'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.9.0/lib/fog/compute/models/aws/server.rb:164:in `save'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.9.0/lib/fog/core/collection.rb:50:in `create'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_lab.rb:28:in `build'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:70:in `build_test_lab'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:59:in `setup'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
My knife.rb is
current_dir = File.dirname(__FILE__)
user = ENV['OPSCODE_USER'] || ENV['USER']
ENV['ORGNAME'] ||= (ENV['OPSCODE_ORGNAME'] || "#{user}-test")
orgname = ENV['ORGNAME']
chef_home = "#{ENV['HOME']}/.chef"
log_level :info
log_location STDOUT
node_name user
client_key "#{chef_home}/#{user}.pem"
validation_client_name "#{orgname}-validator"
validation_key "#{chef_home}/#{orgname}-validator.pem"
chef_server_url "https://api.opscode.com/organizations/#{orgname}"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID'] || Fog.credentials[:aws_access_key_id]
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY'] || Fog.credentials[:aws_secret_access_key]
knife[:identity_file] = '~/.ec2/id_rsa-ec2'
knife[:aws_ssh_key_id] = client_key
knife[:availability_zone] = 'us-east-1a'
knife[:region] = 'us-east-1'
knife[:aws_image_id] = 'ami-a403f7cd' # http://aws.amazon.com/amis/Community/4347
$ ls -al ~/.chef/
total 16
drwx------ 5 drnic staff 170B Jul 27 18:20 .
drwxr-xr-x+ 116 drnic staff 3.9K Jul 27 15:07 ..
drwxr-xr-x 2 drnic staff 68B Jul 27 18:20 checksums
-rw-r--r--@ 1 drnic staff 1.6K Jul 27 11:50 drnic-test-validator.pem
-rw-r--r--@ 1 drnic staff 1.6K Jul 27 11:50 drnic.pem
So I'm not sure about this missing file
This file is missing: /Users/drnic/.chef/drnic.pem
please fix it and try again and tell me if it works
Your knife[:aws_ssh_key_id] must be the name you gave to this key in the Amazon EC2 Panel, not the filename
Ok great, fixed.
$ cucumber-chef setup
Provisioning cucumber-chef test lab platform.
Waiting for server.............
Instance ID: i-d55feeb4 ; IP Address 184.72.200.66
Platform provisioned. Run cucumber-chef project to get started.
Is this supposed to freeze here? Sorry that this is an unrelated question.
I left the cucumber-chef setup
running on one terminal, went to another:
$ cucumber-chef test teamserver
/Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_lab.rb:59:in `public_hostname': undefined method `cloud' for nil:NilClass (NoMethodError)
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:25:in `upload_project'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:15:in `run'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:120:in `test'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
I don't think it is an unrelated question. Actually, the setup process in cucumber chef is quite unstable. I'm experiencing some similar problems. If it get stuck for a long time (more than 2 minutes), I just hit CTRL+C and destroy/setup it again. Usually it will work.
But after that, when chef start to setup the lxc configuration, I get into this error:
ec2-107-20-3-20.compute-1.amazonaws.com [Wed, 27 Jul 2011 21:53:04 +0000] ERROR: template[/usr/lib/lxc/templates/lxc-lucid-chef] (cucumber-chef::lxc line 26) has had an error
ec2-107-20-3-20.compute-1.amazonaws.com [Wed, 27 Jul 2011 21:53:04 +0000] ERROR: Running exception handlers
ec2-107-20-3-20.compute-1.amazonaws.com [Wed, 27 Jul 2011 21:53:04 +0000] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ec2-107-20-3-20.compute-1.amazonaws.com [Wed, 27 Jul 2011 21:53:04 +0000] ERROR: Exception handlers complete
ec2-107-20-3-20.compute-1.amazonaws.com [Wed, 27 Jul 2011 21:53:04 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
ec2-107-20-3-20.compute-1.amazonaws.com [Wed, 27 Jul 2011 21:53:04 +0000] FATAL: Errno::ENOENT: template[/usr/lib/lxc/templates/lxc-lucid-chef] (cucumber-chef::lxc line 26) had an error: No such file or directory - /tmp/chef-rendered-template20110727-635-bic4js-0 or /usr/lib/lxc/templates/lxc-lucid-chef
Try it out and see if you can go further
I left the cucumber-chef setup running on one terminal, went to another:
I think the whole setup process needs to get finished before you can run tests.
Ah, I wasn't patient enough. Now I see the setup task failing:
$ cucumber-chef setup
Provisioning cucumber-chef test lab platform.
Waiting for server.............
Instance ID: i-07fd4e66 ; IP Address 174.129.101.73
Platform provisioned. Run cucumber-chef project to get started.
WARNING: Failed to connect to ec2-174-129-101-73.compute-1.amazonaws.com -- Errno::ETIMEDOUT: Operation timed out - connect(2)
/Users/drnic/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 404 "Not Found" (Net::HTTPServerException)
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:237:in `block in api_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:288:in `retriable_rest_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:218:in `api_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:114:in `get_rest'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/node.rb:603:in `load'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:74:in `tag_node'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:30:in `bootstrap_node'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:63:in `setup'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
Take a look at the second commentary from zts on this page:
https://github.com/Atalanta/cucumber-chef/issues/9
Maybe it will help
Nic, try also to change your configuration to this:
knife[:availability_zone] = "eu-west-1a"
knife[:region] = "eu-west-1"
knife[:aws_image_id] = "ami-339ca947"
I'm almost sure cucumber-chef is very a dependent of specific Linux image The image above worked for me
Ok, I've reverted my knife.rb to the one that is described in the README + the book; except loading the AWS credentials from fog which seemed to work nicely. I've created a "drnic" keypair in eu-west-1, and I've stored the drnic.pem in ~/.chef/
My knife.rb is
current_dir = File.dirname(__FILE__)
user = ENV['OPSCODE_USER'] || ENV['USER']
log_level :info
log_location STDOUT
node_name user
client_key "#{ENV['HOME']}/.chef/#{user}.pem"
validation_client_name "#{ENV['ORGNAME']}-validator"
validation_key "#{ENV['HOME']}/.chef/#{ENV['ORGNAME']}-validator.pem"
chef_server_url "https://api.opscode.com/organizations/#{ENV['ORGNAME']}"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID'] || Fog.credentials[:aws_access_key_id]
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY'] || Fog.credentials[:aws_secret_access_key]
knife[:aws_ssh_key_id] = ENV['AWS_SSH_KEY_ID'] || user
knife[:identity_file] = "#{ENV['HOME']}/.chef/#{user}.pem"
knife[:availability_zone] = "eu-west-1a"
knife[:region] = "eu-west-1"
knife[:aws_image_id] = "ami-339ca947"
But on boot I now get Unauthorised errors:
$ cucumber-chef setup
Provisioning cucumber-chef test lab platform.
Waiting for server.........
Instance ID: i-7a2b090c ; IP Address 46.51.129.20
Platform provisioned. Run cucumber-chef project to get started.
/Users/drnic/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 401 "Unauthorized" (Net::HTTPServerException)
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:237:in `block in api_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:288:in `retriable_rest_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:218:in `api_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:125:in `post_rest'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/cookbook_uploader.rb:65:in `upload_cookbook'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:57:in `upload_cookbook'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:61:in `setup'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
I cannot wait until I figure this out. I will definitely help improve docs :)
hmmm...
I think you are mixing the Amazon key with the chef client key. It needs to be two different .pem files - one for Amazon and other for Chef API and you are using the same:
client_key "#{ENV['HOME']}/.chef/#{user}.pem"
knife[:identity_file] = "#{ENV['HOME']}/.chef/#{user}.pem"
How do I generate the Chef API key?
I made the following
$ ls -al ~/.ssh | grep ec2
-rw------- 1 drnic staff 1675 Jul 27 15:29 id_rsa-ec2
-rw-r--r-- 1 drnic staff 399 Jul 27 15:29 id_rsa-ec2.pub
but I get similar issues.
Can you paste in your knife.rb?
You can follow the instructions on this page:
http://help.opscode.com/kb/start/2-setting-up-your-user-environment
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "danicuki"
client_key "#{current_dir}/danicuki.pem"
validation_client_name "usp-validator"
validation_key "#{current_dir}/usp-validator.pem"
chef_server_url "https://api.opscode.com/organizations/usp"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID']
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY']
knife[:identity_file] = "/Users/danicuki/.ssh/chef.pem"
knife[:aws_ssh_key_id] = "chef"
knife[:availability_zone] = "eu-west-1a"
knife[:region] = "eu-west-1"
knife[:aws_image_id] = "ami-339ca947"
Thanks mate.
How do you create your chef.pem?
The chef.pem I've created in Amazon EC2 Panel, clicking on "Key Pairs" link. Remember to created it in the same region you put in the knife.rb file (eu-west in this case)
Why the two sets of .pem files? Sorry if this is a stupid question.
Arrgh, how badly do I suck at this?!
my knife.rb now:
current_dir = File.dirname(__FILE__)
user = ENV['OPSCODE_USER'] || ENV['USER']
log_level :info
log_location STDOUT
node_name user
client_key "#{ENV['HOME']}/.chef/#{user}.pem"
validation_client_name "#{ENV['ORGNAME']}-validator"
validation_key "#{ENV['HOME']}/.chef/#{ENV['ORGNAME']}-validator.pem"
chef_server_url "https://api.opscode.com/organizations/#{ENV['ORGNAME']}"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID'] || Fog.credentials[:aws_access_key_id]
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY'] || Fog.credentials[:aws_secret_access_key]
knife[:aws_ssh_key_id] = "chef"
knife[:identity_file] = "#{ENV['HOME']}/.chef/chef.pem"
knife[:availability_zone] = "eu-west-1a"
knife[:region] = "eu-west-1"
knife[:aws_image_id] = "ami-339ca947"
My keys:
$ ll ~/.chef/
total 40
drwx------ 8 drnic staff 272B Jul 29 06:31 .
drwxr-xr-x+ 116 drnic staff 3.9K Jul 28 08:54 ..
drwxr-xr-x 2 drnic staff 68B Jul 27 18:20 checksums
-rw-------@ 1 drnic staff 1.7K Jul 29 06:31 chef-eu-west-1.pem
-rw-------@ 1 drnic staff 1.7K Jul 29 06:31 chef.pem
-rw-------@ 1 drnic staff 1.7K Jul 28 15:25 drnic-eu-west-1.pem
-rw-------@ 1 drnic staff 1.6K Jul 27 11:50 drnic-test-validator.pem
-rw-------@ 1 drnic staff 1.7K Jul 28 15:52 drnic.pem
The keys I've generated in EU West in my AWS console https://skitch.com/drnic/fcchf/key-pairs
Still getting the 401 "Unauthorized" error:
$ cucumber-chef setup
Provisioning cucumber-chef test lab platform.
Waiting for server........
Instance ID: i-da6548ac ; IP Address 46.137.136.173
Platform provisioned. Run cucumber-chef project to get started.
/Users/drnic/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 401 "Unauthorized" (Net::HTTPServerException)
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:237:in `block in api_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:288:in `retriable_rest_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:218:in `api_request'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/rest.rb:125:in `post_rest'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.2/lib/chef/cookbook_uploader.rb:65:in `upload_cookbook'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:57:in `upload_cookbook'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:61:in `setup'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/drnic/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
My displayconfig:
$ cucumber-chef displayconfig
mode: user
node_name: drnic
chef_server_url: https://api.opscode.com/organizations/drnic-test
client_key: /Users/drnic/.chef/drnic.pem
validation_key: /Users/drnic/.chef/drnic-test-validator.pem
validation_client_name: drnic-test-validator
knife[:aws_access_key_id]: XXXX
knife[:aws_secret_access_key]: XXXX
knife[:region]: eu-west-1
knife[:aws_image_id]: ami-339ca947
knife[:availability_zone]: eu-west-1a
knife[:aws_ssh_key_id]: chef
knife[:identity_file]: /Users/drnic/.chef/chef.pem
Try to replace the drnic.pem key by the one you obtain on this link:
I have the same issue as mentioned in subject.
First, I get this:
$ cucumber-chef setup
Provisioning cucumber-chef test lab platform.
Waiting for server................
Instance ID: i-013a2560 ; IP Address 50.19.16.236
Platform provisioned. Run cucumber-chef project to get started.
/Users/serp/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 404 "Not Found" (Net::HTTPServerException)
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/rest.rb:237:in `block in api_request'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/rest.rb:288:in `retriable_rest_request'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/rest.rb:218:in `api_request'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/rest.rb:114:in `get_rest'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/node.rb:603:in `load'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:74:in `tag_node'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/provisioner.rb:30:in `bootstrap_node'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:63:in `setup'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
After printing "Platform provisioned. Run cucumber-chef project to get started.", cucumber-chef is silent for several seconds and then 404 error is raised.
Then, I get this while trying to run default example:
$ cucumber-chef test base
/Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_lab.rb:59:in `public_hostname': undefined method `cloud' for nil:NilClass (NoMethodError)
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:25:in `upload_project'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:15:in `run'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:120:in `test'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
knife.rb settings:
...
knife[:region]: us-east-1
knife[:aws_image_id]: ami-a6f504cf # Ubuntu 10.10 Maverick instance-store found on http://alestic.com/
knife[:availability_zone]: us-east-1a
...
I'll try to use AMI from docs in eu-west-1 and will let you know if this helps.
UPDATE: No luck even on eu-west-1, digging further...
404 response seems to be returned by this URL: https://api.opscode.com/organizations/#{ORGNAME}/nodes/cucumber-chef-test-lab.
After logging in to manage.opscode.com, I don't see node with name "cucumber-chef-test-lab" there. knife node list confirms that.
So, my initial expectation is that machine has failed to register with chef-client.
UPDATE: I've found two problems with newly booted instance: default security group wasn't allowing IP 0.0.0.0/0 port 22 and SSH .pem that was specified in knife[:identity_file] had wrong access mode (should be 600). After fixing those issues, cucumber-chef setup seems to freeze for a long time just after calling PUT https://api.opscode.com/organizations/#{ORGNAME}/roles/controller.
It took 11 minutes to finish bootstrapping Test Lab. I think "Platform provisioned. Run cucumber-chef project to get started." should be printed after Test Lab is up and running, and some kind of progress bar should be displayed while it is being bootstrapped.
Nevertheless, I still get "undefined method `cloud' for nil:NilClass (NoMethodError)" error. It is caused by call to https://api.opscode.com/organizations/#{ORGNAME}/search/node?q=roles:test_lab_test%2520AND%2520tags:user&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000 returning "{\"total\":0,\"start\":0,\"rows\":[]}".
I'm able to find role called "test_lab_test" manually in search field of manage.opscode.com, but node "cucumber-chef-test-lab" doesn't have anything in its runlist and query "roles:test_lab_test" returns empty list of nodes.
After patching cucumber-chef-1.0.3/lib/cucumber/chef/test_lab.rb:65 like this, so it returns proper node:
query = "name:cucumber-chef-test-lab" #"roles:test_lab_test AND tags:#{mode}"
I'm getting another error:
/Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/node/attribute.rb:428:in `method_missing': Attribute cloud is not defined! (ArgumentError)
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/node.rb:346:in `method_missing'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_lab.rb:59:in `public_hostname'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:25:in `upload_project'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:15:in `run'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:120:in `test'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `load'
from /Users/serp/.rvm/gems/ruby-1.9.2-p180/bin/cucumber-chef:19:in `<main>'
Ok, so that's the problem (taken from /var/chef/cache/chef-stacktrace.out):
Chef::Exceptions::ShellCommandFailed: execute[chroot /var/lib/lxc/controller/rootfs /bin/bash -c "chef-client -j /etc/chef/first-boot.json > /dev/null 2>&1"] (cucumber-chef::controller line 42) had an error: Expected process to exit with [0], but received '1'
---- Begin output of chroot /var/lib/lxc/controller/rootfs /bin/bash -c "chef-client -j /etc/chef/first-boot.json > /dev/null 2>&1" ----
STDOUT:
STDERR:
---- End output of chroot /var/lib/lxc/controller/rootfs /bin/bash -c "chef-client -j /etc/chef/first-boot.json > /dev/null 2>&1" ----
Ran chroot /var/lib/lxc/controller/rootfs /bin/bash -c "chef-client -j /etc/chef/first-boot.json > /dev/null 2>&1" returned 1
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/shell_out.rb:207:in `invalid!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/shell_out.rb:193:in `error!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/shell_out.rb:36:in `shell_out!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/execute.rb:58:in `action_run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in `send'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:437:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:45:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:81:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/runner.rb:76:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:312:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:160:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:239:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `loop'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26
/usr/bin/chef-client:19:in `load'
/usr/bin/chef-client:19
In turn, that's why chef-client fails inside of chroot:
ArgumentError: gem_package[cucumber] (cucumber-chef::testrunner line 20) had an error: invalid byte sequence in US-ASCII
/usr/local/lib/ruby/1.9.1/rubygems/specification.rb:519:in `normalize_yaml_input'
/usr/local/lib/ruby/1.9.1/rubygems/specification.rb:479:in `from_yaml'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:183:in `load_gemspec'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:51:in `block in initialize'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:32:in `initialize'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `new'
/usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `open'
/usr/local/lib/ruby/1.9.1/rubygems/package.rb:58:in `open'
/usr/local/lib/ruby/1.9.1/rubygems/format.rb:63:in `from_io'
/usr/local/lib/ruby/1.9.1/rubygems/format.rb:51:in `block in from_file_by_path'
/usr/local/lib/ruby/1.9.1/open-uri.rb:35:in `open'
/usr/local/lib/ruby/1.9.1/open-uri.rb:35:in `open'
/usr/local/lib/ruby/1.9.1/rubygems/format.rb:50:in `from_file_by_path'
/usr/local/lib/ruby/1.9.1/rubygems/installer.rb:118:in `initialize'
/usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:264:in `new'
/usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:264:in `block in install'
/usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:247:in `each'
/usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:247:in `install'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package/rubygems.rb:154:in `block (2 levels) in install'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package/rubygems.rb:177:in `with_correct_verbosity'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package/rubygems.rb:153:in `block in install'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package/rubygems.rb:88:in `with_gem_sources'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package/rubygems.rb:152:in `install'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package/rubygems.rb:401:in `install_package'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/package.rb:60:in `action_install'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource.rb:437:in `run_action'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:45:in `run_action'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:81:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:81:in `block in converge'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection.rb:94:in `block in execute_each_resource'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:76:in `converge'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/client.rb:312:in `converge'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/client.rb:160:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application/client.rb:239:in `block in run_application'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application/client.rb:229:in `loop'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application/client.rb:229:in `run_application'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application.rb:67:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-0.10.4/bin/chef-client:26:in `<top (required)>'
/usr/local/bin/chef-client:19:in `load'
/usr/local/bin/chef-client:19:in `<main>'
Is there any movement on this error? I've just bumped into it. I had to manually run the ssh command on the server though.
Something in setup process fails, after ssh into the box and running chef-client
I noticed the run_list
and roles
attributes were empty...
EDIT: It appears that my organization was set wrong
1.0.4 is broken. I'm working on fixes, I won't have time until the weekend, try 1.0.3.
Ok thx, i found this topic so i just delete my post until i will try ! https://github.com/Atalanta/cucumber-chef/issues/39
Ok, i still have an issue, even with 1.0.3 Edit: same result with 1.0.2, maybe i misconfigured something ?
kurt@adam:~/projects/chef-repo$ cucumber-chef setup
Provisioning cucumber-chef test lab platform.
Waiting for server.....................
Instance ID: i-1a25f653 ; IP Address 46.51.138.224
Platform provisioned. Run cucumber-chef project to get started.
kurt@adam:~/projects/chef-repo$ cucumber-chef test ssh
/home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_lab.rb:59:in `public_hostname': undefined method `cloud' for nil:NilClass (NoMethodError)
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:25:in `upload_project'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/cucumber-chef-1.0.3/lib/cucumber/chef/test_runner.rb:15:in `run'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/cucumber-chef-1.0.3/bin/cucumber-chef:120:in `test'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/gems/cucumber-chef-1.0.3/bin/cucumber-chef:123:in `<top (required)>'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/bin/cucumber-chef:19:in `load'
from /home/kurt/.rvm/gems/ruby-1.9.2-p290@chef/bin/cucumber-chef:19:in `<main>'
Some infos, my gems versions:
kurt@adam:~/projects/chef-repo$ gem list | grep cucumber
cucumber (1.1.1)
cucumber-chef (1.0.3)
cucumber-nagios (0.9.2)
+
fog (1.0.0)
my knife.rb:
kurt@adam:~/projects/chef-repo$ cat .chef/knife.rb
current_dir = File.dirname(__FILE__)
user = ENV['OPSCODE_USER'] || ENV['USER']
log_level :info
log_location STDOUT
node_name "kurt"
client_key "#{ENV['HOME']}/.chef/#{user}.pem"
validation_client_name "#{ENV['ORGNAME']}-validator"
validation_key "#{ENV['HOME']}/.chef/#{validation_client_name}.pem"
chef_server_url "https://api.opscode.com/organizations/#{ENV['ORGNAME']}"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID']
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY']
knife[:identity_file] = "#{ENV['HOME']}/.ec2/chef.pem"
knife[:aws_ssh_key_id] = ENV['AWS_SSH_KEY_ID']
knife[:availability_zone] = "eu-west-1a"
knife[:region] = "eu-west-1"
knife[:aws_image_id] = "ami-339ca947"
my config
kurt@adam:~/projects/chef-repo$ cucumber-chef displayconfig
mode: user
node_name: kurt
chef_server_url: https://api.opscode.com/organizations/yuweb
client_key: /home/kurt/.chef/kurt.pem
validation_key: /home/kurt/.chef/yuweb-validator.pem
validation_client_name: yuweb-validator
knife[:aws_access_key_id]: XXX
knife[:aws_secret_access_key]: XXX
knife[:region]: eu-west-1
knife[:aws_image_id]: ami-339ca947
knife[:availability_zone]: eu-west-1a
knife[:aws_ssh_key_id]: chef
knife[:identity_file]: /home/kurt/.ec2/chef.pem
Is there any update on this issue? Anyone managed to get it to work?
I'm also having the same problem (public_hostname': undefined method
cloud' for nil:NilClass (NoMethodError))
Tried with cucumber-chef 1.0.3, 1.0.4 and the latest git head revision... Trying to run the example from the book but can't figure it out :(
This should be fixed in the RC branch. Please build a gem and test - this should be fine now. There will probably be problems beyond that - but we're on it.
This has been fixed in 2.0.0.rc1; please pull the latest development version to verify.
If you are still experiencing issues with this please re-open this issue; I am closing this for now since it has become stale.
I have my
.chef/knife.rb
as:And I ran:
Ideas?