Merge branch 'puppet_structured_facts_toyaml_on_provisioner' of git://github.com/aloyr/vagrant into aloyr-puppet_structured_facts_toyaml_on_provisioner
This commit is contained in:
commit
7fe03988aa
|
@ -8,6 +8,7 @@ module VagrantPlugins
|
|||
attr_accessor :binary_path
|
||||
|
||||
attr_accessor :facter
|
||||
attr_accessor :structured_facts
|
||||
attr_accessor :hiera_config_path
|
||||
attr_accessor :manifest_file
|
||||
attr_accessor :manifests_path
|
||||
|
@ -37,6 +38,7 @@ module VagrantPlugins
|
|||
@synced_folder_type = UNSET_VALUE
|
||||
@temp_dir = UNSET_VALUE
|
||||
@working_directory = UNSET_VALUE
|
||||
@structured_facts = UNSET_VALUE
|
||||
end
|
||||
|
||||
def nfs=(value)
|
||||
|
|
|
@ -132,6 +132,22 @@ module VagrantPlugins
|
|||
@machine.communicate.upload(local_hiera_path, @hiera_config_path)
|
||||
end
|
||||
|
||||
# Build up the structured custom facts if we have any
|
||||
# With structured facts on, we assume the config.facter is yaml.
|
||||
if config.structured_facts && !config.facter.empty?
|
||||
@facter_config_path = "/etc/puppetlabs/facter/facts.d/vagrant_facts.yaml"
|
||||
if windows?
|
||||
@facter_config_path = "/ProgramData/PuppetLabs/facter/facts.d/vagrant_facts.yaml"
|
||||
end
|
||||
t = Tempfile.new("vagrant_facts.yaml")
|
||||
t.write(config.facter.to_yaml)
|
||||
t.close()
|
||||
@machine.communicate.tap do |comm|
|
||||
comm.upload(t.path, File.join(@config.temp_dir, "vagrant_facts.yaml"))
|
||||
comm.sudo("cp #{config.temp_dir}/vagrant_facts.yaml #{@facter_config_path}")
|
||||
end
|
||||
end
|
||||
|
||||
run_puppet_apply
|
||||
end
|
||||
|
||||
|
@ -213,7 +229,8 @@ module VagrantPlugins
|
|||
|
||||
# Build up the custom facts if we have any
|
||||
facter = nil
|
||||
if !config.facter.empty?
|
||||
# Build up the (non-structured) custom facts if we have any
|
||||
if !config.structured_facts && !config.facter.empty?
|
||||
facts = []
|
||||
config.facter.each do |key, value|
|
||||
facts << "FACTER_#{key}='#{value}'"
|
||||
|
|
Loading…
Reference in New Issue