Add the :facter option for puppet server [GH-790]

This commit is contained in:
Mitchell Hashimoto 2012-03-09 12:16:27 -08:00
parent 0b28910b77
commit 37b8a13179
2 changed files with 15 additions and 1 deletions

View File

@ -11,6 +11,7 @@
something other than the current directory.
- Downloading boxes from servers that don't send a content-length
now works properly. [GH-788]
- The `:facter` option now works for puppet server. [GH-790]
## 1.0.0 (March 6, 2012)

View File

@ -9,7 +9,9 @@ module Vagrant
attr_accessor :puppet_server
attr_accessor :puppet_node
attr_accessor :options
attr_accessor :facter
def facter; @facter ||= {}; end
def puppet_server; @puppet_server || "puppet"; end
def options; @options ||= []; end
end
@ -53,7 +55,18 @@ module Vagrant
options += ["--certname", cn] if cn
options = options.join(" ")
command = "puppetd #{options} --server #{config.puppet_server}"
# Build up the custom facts if we have any
facter = ""
if !config.facter.empty?
facts = []
config.facter.each do |key, value|
facts << "FACTER_#{key}='#{value}'"
end
facter = "#{facts.join(" ")} "
end
command = "#{facter}puppetd #{options} --server #{config.puppet_server}"
env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
env[:vm].channel.sudo(command) do |type, data|