puppet: Add "to_yaml" to facter call

The rationale here is to make it so existing Vagrantfile
configurations remain unchanged.

While benh57's solution worked for me, I had to add a
".to_yaml" to the VagrantFile line that implemented puppet.facter
and this would mean existing Vagrant configurations that use Puppet
would produce an error if that was not present.

Additionally, without this change, the Vagrant file also needed a
"require('yaml')" declaration to make the ".to_yaml" conversion
possible.
This commit is contained in:
Peter Carrero 2016-04-13 16:11:25 -05:00
parent 4d4bba119a
commit d5c13dda64
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ module VagrantPlugins
@facter_config_path = "/ProgramData/PuppetLabs/facter/facts.d/vagrant_facts.yaml" @facter_config_path = "/ProgramData/PuppetLabs/facter/facts.d/vagrant_facts.yaml"
end end
t = Tempfile.new("vagrant_facts.yaml") t = Tempfile.new("vagrant_facts.yaml")
t.write(config.facter) t.write(config.facter.to_yaml)
t.close() t.close()
@machine.communicate.tap do |comm| @machine.communicate.tap do |comm|
comm.upload(t.path, File.join(@config.temp_dir, "vagrant_facts.yaml")) comm.upload(t.path, File.join(@config.temp_dir, "vagrant_facts.yaml"))