From 37b8a13179f12f97651a6b7028a0e6dfd5777947 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 9 Mar 2012 12:16:27 -0800 Subject: [PATCH] Add the :facter option for puppet server [GH-790] --- CHANGELOG.md | 1 + lib/vagrant/provisioners/puppet_server.rb | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e42faf8..399358bb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/vagrant/provisioners/puppet_server.rb b/lib/vagrant/provisioners/puppet_server.rb index 67882b456..ade4f65ee 100644 --- a/lib/vagrant/provisioners/puppet_server.rb +++ b/lib/vagrant/provisioners/puppet_server.rb @@ -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|