class Kitchen::Provisioner::ChefApply
Chef
Apply provisioner.
@author SAWANOBORI Yukihiko <sawanoboriyu@higanworks.com>)
Public Instance Methods
create_sandbox()
click to toggle source
(see ChefBase#create_sandbox
)
# File lib/kitchen/provisioner/chef_apply.rb, line 71 def create_sandbox @sandbox_path = Dir.mktmpdir("#{instance.name}-sandbox-") File.chmod(0755, sandbox_path) info("Preparing files for transfer") debug("Creating local sandbox in #{sandbox_path}") prepare_json prepare(:apply) end
init_command()
click to toggle source
(see ChefBase#init_command
)
# File lib/kitchen/provisioner/chef_apply.rb, line 82 def init_command dirs = %w{ apply }.sort.map { |dir| remote_path_join(config[:root_path], dir) } vars = if powershell_shell? init_command_vars_for_powershell(dirs) else init_command_vars_for_bourne(dirs) end prefix_command(shell_code_from_file(vars, "chef_base_init_command")) end
run_command()
click to toggle source
(see ChefSolo#run_command
)
# File lib/kitchen/provisioner/chef_apply.rb, line 97 def run_command level = config[:log_level] lines = [] config[:run_list].map do |recipe| cmd = sudo(config[:chef_apply_path]).dup .tap { |str| str.insert(0, "& ") if powershell_shell? } args = [ "apply/#{recipe}.rb", "--log_level #{level}", "--no-color", ] args << "--logfile #{config[:log_file]}" if config[:log_file] args << "--chef-license #{config[:chef_license]}" if config[:chef_license] lines << wrap_shell_code( [cmd, *args].join(" ") .tap { |str| str.insert(0, reload_ps1_path) if windows_os? } ) end prefix_command(lines.join("\n")) end