Class: Kitchen::Provisioner::ChefZero
- Defined in:
- lib/kitchen/provisioner/chef_zero.rb
Overview
Chef Zero provisioner.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from ChefBase
#init_command, #install_command
Methods inherited from Base
#[], #calculate_path, #cleanup_sandbox, #config_keys, #diagnose, #init_command, #initialize, #install_command, #name, #sandbox_path
Constructor Details
This class inherits a constructor from Kitchen::Provisioner::Base
Instance Method Details
#create_sandbox ⇒ Object
34 35 36 37 38 39 |
# File 'lib/kitchen/provisioner/chef_zero.rb', line 34 def create_sandbox super prepare_chef_client_zero_rb prepare_validation_pem prepare_client_rb end |
#prepare_command ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/kitchen/provisioner/chef_zero.rb', line 41 def prepare_command return if local_mode_supported? ruby_bin = config[:ruby_bindir] # use Bourne (/bin/sh) as Bash does not exist on all Unix flavors # # * we are installing latest chef in order to get chef-zero and # Chef::ChefFS only. The version of Chef that gets run will be # the installed omnibus package. Yep, this is funky :) <<-PREPARE.gsub(/^ {10}/, '') sh -c ' #{chef_client_zero_env(:export)} if ! #{sudo("#{ruby_bin}/gem")} list chef-zero -i >/dev/null; then echo ">>>>>> Attempting to use chef-zero with old version of Chef" echo "-----> Installing chef zero dependencies" #{sudo("#{ruby_bin}/gem")} install chef --no-ri --no-rdoc --conservative fi' PREPARE end |
#run_command ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/kitchen/provisioner/chef_zero.rb', line 62 def run_command args = [ "--config #{config[:root_path]}/client.rb", "--log_level #{config[:log_level]}" ] if config[:json_attributes] args << "--json-attributes #{config[:root_path]}/dna.json" end if local_mode_supported? ["#{sudo('chef-client')} -z"].concat(args).join(" ") else [ chef_client_zero_env, sudo("#{config[:ruby_bindir]}/ruby"), "#{config[:root_path]}/chef-client-zero.rb" ].concat(args).join(" ") end end |