lib/commands/testlab.rb in testlab-1.18.1 vs lib/commands/testlab.rb in testlab-1.19.0

- old
+ new

@@ -31,11 +31,11 @@ TestLab will then attempt to build the components, executing the following tasks for each: Create -> Up -> Provision EOF command :build do |build| - build.action do |global_options,options,args| + build.action do |global_options, options, args| @testlab.build end end # LAB DEMOLISH @@ -51,11 +51,11 @@ TestLab will then attempt to demolish the components, executing the following tasks for each: Deprovision -> Down -> Destroy EOF command :demolish do |demolish| - demolish.action do |global_options,options,args| + demolish.action do |global_options, options, args| @testlab.demolish end end # LAB BOUNCE @@ -71,11 +71,11 @@ Then components are onlined in the following order: Nodes -> Networks -> Containers EOF command :bounce do |bounce| - bounce.action do |global_options,options,args| + bounce.action do |global_options, options, args| @testlab.bounce end end # LAB RECYCLE @@ -91,11 +91,11 @@ Then components are built in the following order: Nodes -> Networks -> Containers EOF command :recycle do |recycle| - recycle.action do |global_options,options,args| + recycle.action do |global_options, options, args| @testlab.recycle end end # LAB CREATE @@ -107,11 +107,11 @@ The components are created in the following order: Nodes -> Networks -> Containers EOF command :create do |create| - create.action do |global_options,options,args| + create.action do |global_options, options, args| @testlab.create end end # LAB DESTROY @@ -123,11 +123,11 @@ The components are destroyed in the following order: Nodes -> Networks -> Containers EOF command :destroy do |destroy| - destroy.action do |global_options,options,args| + destroy.action do |global_options, options, args| @testlab.destroy end end # LAB ONLINE @@ -139,11 +139,11 @@ The components are onlined in the following order: Nodes -> Networks -> Containers EOF command :up do |up| - up.action do |global_options,options,args| + up.action do |global_options, options, rgs| @testlab.up end end # LAB OFFLINE @@ -155,11 +155,11 @@ The components are offlined in the following order: Containers -> Networks -> Nodes EOF command :down do |down| - down.action do |global_options,options,args| + down.action do |global_options, options, args| @testlab.down end end # LAB PROVISION @@ -171,11 +171,11 @@ The components are provisioned in the following order: Nodes -> Networks -> Containers EOF command :provision do |provision| - provision.action do |global_options,options,args| + provision.action do |global_options, options, args| @testlab.provision end end # LAB DEPROVISION @@ -187,20 +187,20 @@ The components are torndown in the following order: Containers -> Networks -> Nodes EOF command :deprovision do |deprovision| - deprovision.action do |global_options,options,args| + deprovision.action do |global_options, options, args| @testlab.deprovision end end # LAB STATUS ############# desc 'Display the lab status' command :status do |status| - status.action do |global_options,options,args| + status.action do |global_options, options, args| @testlab.ui.logger.level = ZTK::Logger::WARN @testlab.ui.stdout.puts("\nNODES:".green.bold) commands[:node].commands[:status].execute({}, {}, []) @testlab.ui.stdout.puts("\nNETWORKS:".green.bold) @@ -209,9 +209,28 @@ @testlab.ui.stdout.puts("\nCONTAINERS:".green.bold) commands[:container].commands[:status].execute({}, {}, []) end end +# LAB BUG REPORT +################# +desc 'Generate a lab bug report' +command :bugreport do |bugreport| + bugreport.action do |global_options, options, args| + @testlab.ui.logger.level = ZTK::Logger::FATAL + + report_file = File.join("", "tmp", "testlab-bug-report.#{Time.now.utc.to_i}") + + content = Array.new + content << (IO.read(DEFAULT_DUMP_FILE) rescue nil) + content << ("#{'=' * 30} TestLab Log #{'=' * 30}") + content << IO.read(DEFAULT_LOG_BACKUP) + + IO.write(report_file, content.flatten.compact.join("\n")) + + @testlab.ui.stdout.puts("The bug report for your most recent execution of TestLab is located at #{report_file.inspect}.") + end +end # LAB DOCTOR ############# desc 'Check the health of the lab' long_desc <<-EOF