Class: Kitchen::Verifier::Busser
- Defined in:
- lib/kitchen/verifier/busser.rb
Overview
Command string generator to interface with Busser. The commands that are generated are safe to pass to an SSH command or as an unix command argument (escaped in single quotes).
Instance Attribute Summary
Attributes included from Configurable
Instance Method Summary collapse
-
#create_sandbox ⇒ Object
Creates a temporary directory on the local workstation into which verifier related files and directories can be copied or created.
-
#init_command ⇒ String
Generates a command string which will perform any data initialization or configuration required after the verifier software is installed but before the sandbox has been transferred to the instance.
-
#initialize(config = {}) ⇒ Busser
constructor
Creates a new Busser object using the provided configuration data which will be merged with any default configuration.
-
#install_command ⇒ String
Generates a command string which will install and configure the verifier software on an instance.
-
#run_cmd ⇒ String
deprecated
Deprecated.
When backwards compatibility for old Busser methods is removed, this method will no longer be available. Use
#run_command
in its place. -
#run_command ⇒ String
Generates a command string which will invoke the main verifier command on the prepared instance.
-
#setup_cmd ⇒ String
deprecated
Deprecated.
When backwards compatibility for old Busser methods is removed, this method will no longer be available. Use
#install_command
in its place. -
#sync_cmd ⇒ Object
deprecated
Deprecated.
When backwards compatibility for old Busser methods is removed, this method will no longer be available. Use
transport#upload
to transfer test files in its place.
Methods inherited from Base
#call, #cleanup_sandbox, kitchen_verifier_api_version, #prepare_command, #sandbox_path
Methods included from Logging
#banner, #debug, #error, #fatal, #info, #warn
Methods included from Configurable
#[], #bourne_shell?, #calculate_path, #config_keys, #diagnose, #diagnose_plugin, #finalize_config!, included, #name, #powershell_shell?, #remote_path_join, #unix_os?, #verify_dependencies, #windows_os?
Constructor Details
#initialize(config = {}) ⇒ Busser
Creates a new Busser object using the provided configuration data which will be merged with any default configuration.
58 59 60 |
# File 'lib/kitchen/verifier/busser.rb', line 58 def initialize(config = {}) init_config(config) end |
Instance Method Details
#create_sandbox ⇒ Object
Creates a temporary directory on the local workstation into which verifier related files and directories can be copied or created. The contents of this directory will be copied over to the instance before invoking the verifier's run command. After this method completes, it is expected that the contents of the sandbox is complete and ready for copy to the remote instance.
Note: any subclasses would be well advised to call super first when overriding this method, for example:
63 64 65 66 67 |
# File 'lib/kitchen/verifier/busser.rb', line 63 def create_sandbox super prepare_helpers prepare_suites end |
#init_command ⇒ String
Generates a command string which will perform any data initialization
or configuration required after the verifier software is installed
but before the sandbox has been transferred to the instance. If no work
is required, then nil
will be returned.
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/kitchen/verifier/busser.rb', line 70 def init_command return if local_suite_files.empty? cmd = sudo(config[:busser_bin]).dup .tap { |str| str.insert(0, "& ") if powershell_shell? } prefix_command(wrap_shell_code(Util.outdent!(<<-CMD))) #{busser_env} #{cmd} suite cleanup CMD end |
#install_command ⇒ String
Generates a command string which will install and configure the
verifier software on an instance. If no work is required, then nil
will be returned.
84 85 86 87 88 89 90 |
# File 'lib/kitchen/verifier/busser.rb', line 84 def install_command return if local_suite_files.empty? vars = install_command_vars prefix_command(shell_code_from_file(vars, "busser_install_command")) end |
#run_cmd ⇒ String
When backwards compatibility for old Busser methods is
removed, this method will no longer be available. Use
#run_command
in its place.
Legacy method stub for #run_cmd
which calls #run_command
.
120 |
# File 'lib/kitchen/verifier/busser.rb', line 120 define_method(:run_cmd) { run_command } |
#run_command ⇒ String
Generates a command string which will invoke the main verifier
command on the prepared instance. If no work is required, then nil
will be returned.
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/kitchen/verifier/busser.rb', line 93 def run_command return if local_suite_files.empty? cmd = sudo(config[:busser_bin]).dup .tap { |str| str.insert(0, "& ") if powershell_shell? } prefix_command(wrap_shell_code(Util.outdent!(<<-CMD))) #{busser_env} #{cmd} test CMD end |
#setup_cmd ⇒ String
When backwards compatibility for old Busser methods is
removed, this method will no longer be available. Use
#install_command
in its place.
Legacy method stub for #setup_cmd
which calls #install_command
.
112 |
# File 'lib/kitchen/verifier/busser.rb', line 112 define_method(:setup_cmd) { install_command } |
#sync_cmd ⇒ Object
When backwards compatibility for old Busser methods is
removed, this method will no longer be available. Use
transport#upload
to transfer test files in its place.
Legacy method stub for #sync_cmd
.
127 128 129 130 131 132 |
# File 'lib/kitchen/verifier/busser.rb', line 127 def sync_cmd warn("Legacy call to #sync_cmd cannot be preserved, meaning that " \ "test files will not be uploaded. " \ "Code that calls #sync_cmd can now use the transport#upload " \ "method to transfer files.") end |