Class: Kitchen::Provisioner::Itamae
- Inherits:
-
Base
- Object
- Base
- Kitchen::Provisioner::Itamae
- Defined in:
- lib/kitchen/provisioner/itamae.rb
Instance Method Summary collapse
- #create_sandbox ⇒ Object
- #init_command ⇒ Object
- #install_command ⇒ Object
- #prepare_command ⇒ Object
- #run_command ⇒ Object
Instance Method Details
#create_sandbox ⇒ Object
31 32 33 34 35 |
# File 'lib/kitchen/provisioner/itamae.rb', line 31 def create_sandbox super prepare_json FileUtils.cp_r(Dir.glob("#{config[:itamae_root]}/*"), sandbox_path) end |
#init_command ⇒ Object
38 39 40 41 42 43 |
# File 'lib/kitchen/provisioner/itamae.rb', line 38 def init_command cmd = [] cmd << "#{sudo("rm")} -rf #{config[:root_path]} ; mkdir -p #{config[:root_path]}" debug("Cleanup Kitchen Root") Util.wrap_command(cmd.join("\n")) end |
#install_command ⇒ Object
80 81 82 83 84 |
# File 'lib/kitchen/provisioner/itamae.rb', line 80 def install_command return unless config[:parasite_chef_omnibus] lines = [Util.shell_helpers, download_helpers, chef_helpers, chef_install_function, itamae_install_function] Util.wrap_command(lines.join("\n")) end |
#prepare_command ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/kitchen/provisioner/itamae.rb', line 46 def prepare_command return nil unless config[:use_bundler] debug("Prepare Bundler") cmd = ["cd #{config[:root_path]};"] cmd << "if [ -f Gemfile ] ;then" cmd << "#{sudo("/opt/chef/embedded/bin/bundle")} install --binstubs" cmd << "fi" Util.wrap_command(cmd.join("\n")) end |
#run_command ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/kitchen/provisioner/itamae.rb', line 57 def run_command debug(JSON.pretty_generate(config)) lines = config[:run_list].map do |recipe| cmd = ["cd #{config[:root_path]} ;"] if config[:use_bundler] cmd << "export PATH=#{config[:chef_omnibus_bin_dir]}:$PATH ;" cmd << sudo("./bin/itamae") else cmd << sudo('/opt/chef/bin/itamae') end cmd << 'local' cmd << '--ohai' if config[:with_ohai] cmd << config[:itamae_option] cmd << "-j dna.json" cmd << recipe cmd.join(" ") end debug(lines.join("\n")) Util.wrap_command(lines.join("\n")) end |