-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
From puppet developer training:
extract.rb:
require 'yaml'
Puppet::Parser::Functions.newfunction(:extract, :type => :rvalue) do |args|
raise Puppet::ParseError, "Expects 2 arguments, not #{args.size}" unless args.size == 2
raise Puppet::ParseError, "First function must be an existing filename" unless File.exists?(args[0])
filename = args[0]
key = args[1]
cnf = YAML::load_file(filename)
cnf[key] if cnf
end
puppet apply -e "notice(extract("/etc/classes.yaml", 'classes'))"
notice: Scope(Class[main]): custom bar
notice: Finished catalog run in 0.03 seconds
puppet module install camptocamp-augeasfacter
puppet apply -e "notice(extract("/etc/classes.yaml", 'classes'))"
notice: Finished catalog run in 0.03 seconds
Standard puppet apply is not working.
But: site.pp will be parsed when using puppet apply with augeasfacter installed.
Puppet Version: PE 2.8.1 (Puppet 2.7.21) on CentOS 6.3
Metadata
Metadata
Assignees
Labels
No labels