Method: Beaker::CLI#print_command_line

Defined in:
lib/beaker/cli.rb
Note:

Re-use of already provisioned SUTs has been tested against the vmpooler & vagrant boxes. Fusion doesn’t need this, as it has no cleanup steps. Docker is untested at this time. Please contact @electrical or the Puppet QE Team for more info, or for requests to support this.

Prints the command line that can be called to reproduce this run (assuming the environment is the same)

Examples:

Print pertinent env vars using error level reporting (red)

print_command_line :error

Parameters:

  • log_level (Symbol) (defaults to: :debug)

    The log level (coloring) to print the message at

Returns:

  • nil



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/beaker/cli.rb', line 294

def print_command_line(log_level = :debug)
  @logger.send(log_level, "\nYou can reproduce this run with:\n")
  @logger.send(log_level, @options[:command_line])
  return unless @options[:hosts_preserved_yaml_file]

  set_docker_warning = false
  has_supported_hypervisor = false
  @hosts.each do |host|
    case host[:hypervisor]
    when /vagrant|fusion|vmpooler|vcloud/
      has_supported_hypervisor = true
    when /docker/
      set_docker_warning = true
    end
  end
  return unless has_supported_hypervisor

  reproducing_command = build_hosts_preserved_reproducing_command(@options[:command_line], @options[:hosts_preserved_yaml_file])
  @logger.send(log_level, "\nYou can re-run commands against the already provisioned SUT(s) with:\n")
  @logger.send(log_level, '(docker support is untested for this feature. please reference the docs for more info)') if set_docker_warning
  @logger.send(log_level, reproducing_command)
end