bin/cucumber-chef in cucumber-chef-3.0.0.rc.0 vs bin/cucumber-chef in cucumber-chef-3.0.0.rc.1

- old
+ new

@@ -126,11 +126,11 @@ ################################################################################ # SETUP ################################################################################ - desc "setup", "Setup cucumber-chef test lab in Amazon EC2" + desc "setup", "Setup the cucumber-chef test lab" method_option :test, :type => :boolean, :desc => "INTERNAL USE ONLY" def setup boot if (test_lab = Cucumber::Chef::TestLab.new) @@ -164,11 +164,11 @@ ################################################################################ # DESTROY ################################################################################ - desc "destroy [container]", "Destroy the cucumber-chef test lab in Amazon EC2 or a test lab [container] if specified." + desc "destroy [container] [...]", "Destroy the cucumber-chef test lab or a single or multiple containers if specified" method_option :test, :type => :boolean, :desc => "INTERNAL USE ONLY" def destroy(*args) boot if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.exists? @@ -205,13 +205,11 @@ puts("BOOM!") puts args.each do |container| ZTK::Benchmark.bench(:message => "Destroy container '#{container}'", :mark => "completed in %0.4f seconds.") do - test_lab.containers.load test_lab.containers.destroy(container) - test_lab.containers.save end end else puts @@ -232,11 +230,11 @@ ################################################################################ # UP ################################################################################ - desc "up", "Startup the cucumber-chef test lab" + desc "up", "Power up the cucumber-chef test lab" def up boot if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.dead? ZTK::Benchmark.bench(:message => "Booting #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do @@ -251,20 +249,20 @@ $logger.fatal { e.backtrace.join("\n") } fatal(e) end ################################################################################ -# HALT +# DOWN ################################################################################ - desc "halt", "Power off the cucumber-chef test lab" - def halt + desc "down", "Power off the cucumber-chef test lab" + def down boot if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive? - ZTK::Benchmark.bench(:message => "Halting #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do - test_lab.halt + ZTK::Benchmark.bench(:message => "Downing #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do + test_lab.down end else raise Cucumber::Chef::Error, "We could not find a running test lab." end puts @@ -294,18 +292,18 @@ rescue Cucumber::Chef::Error => e $logger.fatal { e.backtrace.join("\n") } fatal(e) end - desc "genmac", "Generate a private MAC address" + desc "genmac", "Generate an RFC compliant private MAC address" def genmac boot puts Cucumber::Chef::Containers.generate_mac end - desc "genip", "Generate a private IP address" + desc "genip", "Generate an RFC compliant private IP address" def genip boot puts Cucumber::Chef::Containers.generate_ip end @@ -327,17 +325,17 @@ if test_lab.containers.count > 0 headers = [:name, :alive, :distro, :ip, :mac, :"chef version", :persist] results = ZTK::Report.new.spreadsheet(Cucumber::Chef::Container.all, headers) do |container| chef_version = "N/A" - alive = (test_lab.bootstrap_ssh(:ignore_exit_status => true).exec(%Q{ping -n -c 1 -W 1 #{container.ip}}, :silence => true).exit_code == 0) + alive = (test_lab.bootstrap_ssh(:ignore_exit_status => true).exec(%(ping -n -c 1 -W 1 #{container.ip}), :silence => true).exit_code == 0) if alive - chef_version = test_lab.proxy_ssh(container.name, :ignore_exit_status => true).exec(%Q{/usr/bin/env chef-client -v}, :silence => true).output.chomp + chef_version = test_lab.proxy_ssh(container.id, :ignore_exit_status => true).exec(%(/usr/bin/env chef-client -v), :silence => true).output.chomp end OpenStruct.new( - :name => container.name, + :name => container.id, :ip => container.ip, :mac => container.mac, :distro => container.distro, :alive => alive, :"chef version" => chef_version, @@ -376,12 +374,12 @@ ################################################################################ # SSH ################################################################################ - desc "ssh [container]", "SSH to cucumber-chef test lab or [container] if specified." - method_option :bootstrap, :type => :boolean, :desc => "Use the bootstrap settings.", :default => false + desc "ssh [container]", "SSH to cucumber-chef test lab or [container] if specified" + method_option :bootstrap, :type => :boolean, :desc => "Use the bootstrap settings", :default => false def ssh(*args) boot if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive? if @options.bootstrap? @@ -569,11 +567,10 @@ ################################################################################ depreciated_tasks = { "teardown" => "You should execute the 'destroy' task instead.", "info" => "You should execute the 'status' task instead.", - "test" => "You should execute 'cucumber' or 'rspec' directly.", - "down" => "You should execute the 'halt' task instead." + "test" => "You should execute 'cucumber' or 'rspec' directly." } depreciated_tasks.each do |old_task, message| desc old_task, "*DEPRECIATED* - #{message}" define_method(old_task) do