projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yamlinfo: use different dir to list all nodes
[mirror/dsa-puppet.git]
/
modules
/
puppetmaster
/
lib
/
puppet
/
parser
/
functions
/
yamlinfo.rb
diff --git
a/modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb
b/modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb
index
f53014d
..
6590d62
100644
(file)
--- a/
modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb
+++ b/
modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb
@@
-1,10
+1,9
@@
+require 'puppet/file_system'
+
module Puppet::Parser::Functions
newfunction(:yamlinfo, :type => :rvalue) do |args|
host = args[0]
module Puppet::Parser::Functions
newfunction(:yamlinfo, :type => :rvalue) do |args|
host = args[0]
- yamlfile = args[1]
- parser = Puppet::Parser::Parser.new(environment)
- parser.watch_file(yamlfile)
read_yaml = lambda { |yaml, host|
results = {}
read_yaml = lambda { |yaml, host|
results = {}
@@
-24,11
+23,6
@@
module Puppet::Parser::Functions
end
end
end
end
- results['mail_port'] = ''
- results['smarthost'] = ''
- results['heavy_exim'] = ''
- results['smarthost_port'] = 587
-
if yaml['host_settings'].kind_of?(Hash)
yaml['host_settings'].each_pair do |property, values|
if values.kind_of?(Hash)
if yaml['host_settings'].kind_of?(Hash)
yaml['host_settings'].each_pair do |property, values|
if values.kind_of?(Hash)
@@
-43,11
+37,12
@@
module Puppet::Parser::Functions
require 'yaml'
require 'yaml'
+ yamlfile = Puppet::Parser::Files.find_file('debian_org/misc/local.yaml', compiler.environment)
yaml = YAML.load_file(yamlfile)
ret = {}
if host == '*'
yaml = YAML.load_file(yamlfile)
ret = {}
if host == '*'
- Dir.entries('/var/lib/puppet/yaml/
node
/').each do |fname|
+ Dir.entries('/var/lib/puppet/yaml/
facts
/').each do |fname|
next unless fname =~ /(.*)\.yaml$/
host_name = $1
ret[host_name] = read_yaml.call(yaml, host_name)
next unless fname =~ /(.*)\.yaml$/
host_name = $1
ret[host_name] = read_yaml.call(yaml, host_name)