bin/cucumber-chef in cucumber-chef-2.1.0.rc.15 vs bin/cucumber-chef in cucumber-chef-3.0.0.rc.0
- old
+ new
@@ -294,10 +294,24 @@
rescue Cucumber::Chef::Error => e
$logger.fatal { e.backtrace.join("\n") }
fatal(e)
end
+ desc "genmac", "Generate a private MAC address"
+ def genmac
+ boot
+
+ puts Cucumber::Chef::Containers.generate_mac
+ end
+
+ desc "genip", "Generate a private IP address"
+ def genip
+ boot
+
+ puts Cucumber::Chef::Containers.generate_ip
+ end
+
################################################################################
# STATUS
################################################################################
desc "status", "Displays the current status of the test lab."
@@ -309,31 +323,28 @@
if (test_lab = Cucumber::Chef::TestLab.new)
if @options.containers?
if test_lab.alive?
- test_lab.containers.load
-
if test_lab.containers.count > 0
- headers = [:name, :alive, :arch, :distro, :ip, :mac, :"chef version", :persist]
- results = ZTK::Report.new.spreadsheet(test_lab.containers.to_a, headers) do |name, detail|
+ 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 #{detail[:ip]}}, :silence => true).exit_code == 0)
+ alive = (test_lab.bootstrap_ssh(:ignore_exit_status => true).exec(%Q{ping -n -c 1 -W 1 #{container.ip}}, :silence => true).exit_code == 0)
if alive
- chef_version = test_lab.proxy_ssh(name, :ignore_exit_status => true).exec(%Q{/usr/bin/env chef-client -v}, :silence => true).output.chomp
+ chef_version = test_lab.proxy_ssh(container.name, :ignore_exit_status => true).exec(%Q{/usr/bin/env chef-client -v}, :silence => true).output.chomp
end
OpenStruct.new(
- :name => name,
- :ip => detail[:ip],
- :mac => detail[:mac],
- :distro => detail[:distro],
- :arch => detail[:arch],
+ :name => container.name,
+ :ip => container.ip,
+ :mac => container.mac,
+ :distro => container.distro,
:alive => alive,
:"chef version" => chef_version,
- :persist => detail[:persist],
- :chef_attributes => detail[:chef_client]
+ :persist => container.persist,
+ :chef_attributes => container.chef_client
)
end
if @options.attributes?
results.rows.each do |result|
@@ -500,13 +511,14 @@
"root_dir" => Cucumber::Chef.root_dir,
"home_dir" => Cucumber::Chef.home_dir,
"log_file" => Cucumber::Chef.log_file,
"artifacts_dir" => Cucumber::Chef.artifacts_dir,
"config_rb" => Cucumber::Chef.config_rb,
- "containers_bin" => Cucumber::Chef.containers_bin,
- "knife_rb" => Cucumber::Chef.knife_rb,
+ "labfile" => Cucumber::Chef.labfile,
"chef_repo" => Cucumber::Chef.chef_repo,
"bootstrap_identity" => Cucumber::Chef.bootstrap_identity,
+ "chef_user" => Cucumber::Chef.chef_user,
+ "chef_identity" => Cucumber::Chef.chef_identity,
"lab_user" => Cucumber::Chef.lab_user,
"lab_user_home_dir" => Cucumber::Chef.lab_user_home_dir,
"lab_identity" => Cucumber::Chef.lab_identity,
"lxc_user" => Cucumber::Chef.lxc_user,
"lxc_user_home_dir" => Cucumber::Chef.lxc_user_home_dir,