Method: VagrantPlugins::VagrantHyperV::Provisioner::ChefSolo#run_chef_solo

Defined in:
lib/vagrant-windows-hyperv/provisioner/chef_solo.rb

#run_chef_soloObject

[View source]

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/vagrant-windows-hyperv/provisioner/chef_solo.rb', line 109

def run_chef_solo
  if config.run_list && config.run_list.empty?
    @env[:machine].ui.warn(I18n.t("vagrant.chef_run_list_empty"))
  end

  options = [
    "-c #{config.provisioning_path}/solo.rb",
    "-j #{config.provisioning_path}/dna.json"
  ]

  command_env = config.binary_env ? "#{config.binary_env} " : ""
  command_args = config.arguments ? " #{config.arguments}" : ""
  command = "#{command_env}#{chef_binary_path("chef-solo")} " +
    "#{options.join(" ")} #{command_args}"
  config.attempts.times do |attempt|
    if attempt == 0
      @env[:machine].env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
    else
      @env[:machine].env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
    end

    @env[:machine].provider.driver.run_remote_ps(command) do |type, data|
      # Output the data with the proper color based on the stream.
      if (type == :stdout || type == :stderr)
        @env[:ui].detail data
      end
    end
  end

end