Revision cbec253c
Added by Dominic Cleal over 11 years ago
- ID cbec253cc8c85d738e093d33492eb0e7cbdfda4c
foreman_installer/lib/puppet/parser/functions/loadanyyaml.rb | ||
---|---|---|
module Puppet::Parser::Functions
|
||
|
||
newfunction(:loadanyyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
|
||
Load a YAML file containing an array, string, or hash, and return the data
|
||
in the corresponding native data type.
|
||
|
||
For example:
|
||
|
||
$myhash = loadanyyaml('/etc/puppet/data/myhash.yaml')
|
||
ENDHEREDOC
|
||
|
||
args.delete_if { |filename| not File.exist? filename }
|
||
|
||
if args.length == 0
|
||
raise Puppet::ParseError, ("loadanyyaml(): No files to load")
|
||
end
|
||
|
||
YAML.load_file(args[0])
|
||
|
||
end
|
||
|
||
end
|
foreman_installer/lib/puppet/parser/functions/loadyaml.rb | ||
---|---|---|
module Puppet::Parser::Functions
|
||
|
||
newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
|
||
Load a YAML file containing an array, string, or hash, and return the data
|
||
in the corresponding native data type.
|
||
|
||
For example:
|
||
|
||
$myhash = loadyaml('/etc/puppet/data/myhash.yaml')
|
||
ENDHEREDOC
|
||
|
||
args.delete_if { |filename| not File.exist? filename }
|
||
|
||
if args.length == 0
|
||
raise Puppet::ParseError, ("loadyaml(): No files to load")
|
||
end
|
||
|
||
YAML.load_file(args[0])
|
||
|
||
end
|
||
|
||
end
|
foreman_installer/manifests/init.pp | ||
---|---|---|
$answers = undef
|
||
) {
|
||
|
||
$params=loadyaml($answers,
|
||
"/etc/foreman-installer/answers.yaml",
|
||
"${settings::modulepath}/${module_name}/answers.yaml")
|
||
$params=loadanyyaml($answers,
|
||
"/etc/foreman-installer/answers.yaml",
|
||
"${settings::modulepath}/${module_name}/answers.yaml")
|
||
|
||
foreman_installer::yaml_to_class { ['foreman', 'foreman_proxy', 'puppet']: }
|
||
|
Also available in: Unified diff
Rename loadyaml to loadanyyaml to prevent stdlib conflict