Puppet accepts :facter option to override default facts [GH-753]
This commit is contained in:
parent
2c823e98bd
commit
6490710d43
|
@ -32,6 +32,8 @@
|
||||||
- `VM#run_action` is now public so plugin-devs can hook into it.
|
- `VM#run_action` is now public so plugin-devs can hook into it.
|
||||||
- Fix crashing bug when attempting to run commands on the "primary"
|
- Fix crashing bug when attempting to run commands on the "primary"
|
||||||
VM in a multi-VM environment. [GH-761]
|
VM in a multi-VM environment. [GH-761]
|
||||||
|
- With puppet you can now specify `:facter` as a dictionary of facts to
|
||||||
|
override what is generated by Puppet. [GH-753]
|
||||||
|
|
||||||
## 0.9.7 (February 9, 2012)
|
## 0.9.7 (February 9, 2012)
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,13 @@ module Vagrant
|
||||||
attr_accessor :module_path
|
attr_accessor :module_path
|
||||||
attr_accessor :pp_path
|
attr_accessor :pp_path
|
||||||
attr_accessor :options
|
attr_accessor :options
|
||||||
|
attr_accessor :facter
|
||||||
|
|
||||||
def manifest_file; @manifest_file || "default.pp"; end
|
def manifest_file; @manifest_file || "default.pp"; end
|
||||||
def manifests_path; @manifests_path || "manifests"; end
|
def manifests_path; @manifests_path || "manifests"; end
|
||||||
def pp_path; @pp_path || "/tmp/vagrant-puppet"; end
|
def pp_path; @pp_path || "/tmp/vagrant-puppet"; end
|
||||||
def options; @options ||= []; end
|
def options; @options ||= []; end
|
||||||
|
def facter; @facter ||= {}; end
|
||||||
|
|
||||||
# Returns the manifests path expanded relative to the root path of the
|
# Returns the manifests path expanded relative to the root path of the
|
||||||
# environment.
|
# environment.
|
||||||
|
@ -138,7 +140,18 @@ module Vagrant
|
||||||
options << @manifest_file
|
options << @manifest_file
|
||||||
options = options.join(" ")
|
options = options.join(" ")
|
||||||
|
|
||||||
command = "cd #{manifests_guest_path} && puppet apply #{options}"
|
# 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 = "cd #{manifests_guest_path} && #{facter}puppet apply #{options}"
|
||||||
|
|
||||||
env[:ui].info I18n.t("vagrant.provisioners.puppet.running_puppet",
|
env[:ui].info I18n.t("vagrant.provisioners.puppet.running_puppet",
|
||||||
:manifest => @manifest_file)
|
:manifest => @manifest_file)
|
||||||
|
|
Loading…
Reference in New Issue