Class: Kitchen::Provisioner::ChefZero
- Defined in:
- lib/kitchen/provisioner/chef_zero.rb
Overview
Chef Zero provisioner.
Instance Attribute Summary
Attributes included from Configurable
Instance Method Summary collapse
-
#create_sandbox ⇒ Object
Creates a temporary directory on the local workstation into which provisioner related files and directories can be copied or created.
-
#prepare_command ⇒ String
Generates a command string which will perform any commands or configuration required just before the main provisioner run command but after the sandbox has been transferred to the instance.
-
#run_command ⇒ String
Generates a command string which will invoke the main provisioner command on the prepared instance.
Methods inherited from ChefBase
#init_command, #initialize, #install_command
Methods inherited from Base
#call, #cleanup_sandbox, #init_command, #initialize, #install_command, kitchen_provisioner_api_version, #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
This class inherits a constructor from Kitchen::Provisioner::ChefBase
Instance Method Details
#create_sandbox ⇒ Object
Creates a temporary directory on the local workstation into which provisioner related files and directories can be copied or created. The contents of this directory will be copied over to the instance before invoking the provisioner'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:
49 50 51 52 53 54 |
# File 'lib/kitchen/provisioner/chef_zero.rb', line 49 def create_sandbox super prepare_chef_client_zero_rb prepare_validation_pem prepare_client_rb end |
#prepare_command ⇒ String
Generates a command string which will perform any commands or
configuration required just before the main provisioner run command but
after the sandbox has been transferred to the instance. If no work is
required, then nil
will be returned.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kitchen/provisioner/chef_zero.rb', line 57 def prepare_command return if modern? gem_bin = remote_path_join(config[:ruby_bindir], "gem") .tap { |path| path.concat(".bat") if windows_os? } vars = [ chef_client_zero_env, shell_var("gem", sudo(gem_bin)), ].join("\n").concat("\n") prefix_command(shell_code_from_file(vars, "chef_zero_prepare_command_legacy")) end |
#run_command ⇒ String
Generates a command string which will invoke the main provisioner
command on the prepared instance. If no work is required, then nil
will be returned.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/kitchen/provisioner/chef_zero.rb', line 71 def run_command cmd = modern? ? local_mode_command : shim_command prefix_command( wrap_shell_code( [cmd, *chef_client_args, last_exit_code].join(" ") .tap { |str| str.insert(0, reload_ps1_path) if windows_os? } ) ) end |