Atalanta / cucumber-chef

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

cucumber-chef setup #127

Closed hemalvarambhia closed 10 years ago

hemalvarambhia commented 11 years ago

I am following the 'Test-Driven Infrastructure with Chef' book. I tried to run the command cucumber-chef setup with the provider in config.rb set to :aws to try and setup an Amazon ec2 instance. My opcode client and validation keys are in the chef_repo/.chef directory, as is the key value pair generated by the AWS management console (id_rsa-ec2.pem). My knife script looks like this:

current_dir = File.dirname(FILE) user = "hnvarambhia" log_level :info log_location STDOUT node_name "hnvarambhia" client_key "#{current_dir}/hnvarambhia.pem" validation_client_name "musbury-validator" validation_key "#{current_dir}/musbury-validator.pem" chef_server_url "https://api.opscode.com/organizations/musbury" 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] = "#{current_dir}/id_rsa-ec2" knife[:aws_ssh_key_id] = ENV['AWS_SSH_KEY_ID']

On executing the command cucumber-chef setup I got the following stack trace:

Uploading embedded chef-repo /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@global/gems/net-ssh-2.6.6/lib/net/ssh.rb:201:in start': ubuntu (Net::SSH::AuthenticationFailed) from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/ssh.rb:165:inssh' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/ssh/exec.rb:53:in block (2 levels) in exec' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/rescue_retry.rb:114:incall' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/rescue_retry.rb:114:in try' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/ssh/exec.rb:51:inblock in exec' from /Users/hemalvarambhia/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/timeout.rb:58:in timeout' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/ssh/exec.rb:50:inexec' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/cucumber-chef-3.0.8/lib/cucumber/chef/provisioner.rb:74:in block in upload_chef_repo' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/benchmark.rb:88:inblock (2 levels) in bench' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/spinner.rb:59:in spin' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/benchmark.rb:87:inblock in bench' from /Users/hemalvarambhia/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/benchmark.rb:310:in realtime' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/ztk-1.6.1/lib/ztk/benchmark.rb:84:inbench' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/cucumber-chef-3.0.8/lib/cucumber/chef/provisioner.rb:61:in upload_chef_repo' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/cucumber-chef-3.0.8/lib/cucumber/chef/provisioner.rb:45:inbuild' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/cucumber-chef-3.0.8/bin/cucumber-chef:94:in setup' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@global/gems/thor-0.15.2/lib/thor/task.rb:27:inrun' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@global/gems/thor-0.15.2/lib/thor/invocation.rb:120:in invoke_task' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@global/gems/thor-0.15.2/lib/thor.rb:275:indispatch' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@global/gems/thor-0.15.2/lib/thor/base.rb:408:in start' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/cucumber-chef-3.0.8/bin/cucumber-chef:545:in<top (required)>' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/bin/cucumber-chef:23:in load' from /Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/bin/cucumber-chef:23:in

'

cucumber-chef display config is as follows:

:mode: :user :prerelease: false :user: hnvarambhia :artifacts: chef-client-log: /var/log/chef/client.log chef-client-stacktrace: /var/chef/cache/chef-stacktrace.out :chef: :version: latest :container_version: latest :default_password: p@ssw0rd1 :render_client_rb: true :cookbook_paths:

  • cookbooks :prereleases: false :nightlies: false :test_lab: :hostname: cucumber-chef :tld: test-lab :command_timeout: 1800 :provider: :aws :aws: :bootstrap_user: ubuntu :lab_user: cucumber-chef :lxc_user: root :ssh: :lab_port: 22 :lxc_port: 22 :ubuntu_release: precise :aws_instance_arch: i386 :aws_instance_disk_store: ebs :aws_instance_type: c1.medium :aws_security_group: cucumber-chef :identity_file: ubuntu :aws_access_key_id: [REDACTED] :aws_secret_access_key: [REDACTED] :aws_ssh_key_id: id_rsa-ec2 :region: us-west-2 :availability_zone: us-west-2a :vagrant: :bootstrap_user: vagrant :lab_user: cucumber-chef :lxc_user: root :ssh: :lab_ip: 192.168.33.10 :lab_port: 22 :lxc_port: 22 :cpus: 4 :memory: 4096 :identity_file: /Users/hemalvarambhia/.vagrant.d/insecure_private_key

         root_dir = "/Users/hemalvarambhia/.rvm/gems/ruby-1.9.2-p320@chef/gems/cucumber-chef-3.0.8"
         home_dir = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef"
         log_file = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef/cucumber-chef.log"
    artifacts_dir = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef/aws/artifacts"
        config_rb = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef/config.rb"
          labfile = "/Users/hemalvarambhia/RubymineProjects/chef-repo/Labfile"
        chef_repo = "/Users/hemalvarambhia/RubymineProjects/chef-repo"
        chef_user = "hnvarambhia"
    chef_identity = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef/aws/hnvarambhia.pem"

    bootstrap_user = "ubuntu" bootstrap_user_home_dir = "/home/ubuntu" bootstrap_identity = "ubuntu" lab_user = "cucumber-chef" lab_user_home_dir = "/home/cucumber-chef" lab_identity = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef/aws/id_rsa-cucumber-chef" lxc_user = "root" lxc_user_home_dir = "/root" lxc_identity = "/Users/hemalvarambhia/RubymineProjects/chef-repo/.cucumber-chef/aws/id_rsa-root" chef_pre_11 = false

What are the pre conditions for cucumber-chef setup to run successfully?

Many thanks, Hemal

zpatten commented 11 years ago

I suggest you look at the example repo: https://github.com/zpatten/cc-chef-repo

In the very near future, cucumber-chef will be refactored to run via TestLab: https://github.com/zpatten/testlab

anujbiyani commented 11 years ago

To further clarify, I think the book Test-Driven Infrastructure with Chef is quite old and for the most part does not apply to the latest versions of Cucumber-Chef. Unless a new book was released...

hemalvarambhia commented 11 years ago

Thank you, Anuj. It does appear that a significant number of changes have been made to the framework. I will check out the example mentioned earlier.

zpatten commented 11 years ago

Indeed; you guys will have to badger Stephen about that; he told me he would be releasing an updated copy of the book during ChefConf this year; but it looks like that fell through... :(

https://github.com/Atalanta/cucumber-chef/issues/122

hemalvarambhia commented 11 years ago

Hi, I got everthing running. Only thing is I had to use an older build of VirtualBox. Thanks a lot to both of you for the note and instructions. This issue can be closed.

anujbiyani commented 11 years ago

Np! Glad you worked it all out.