projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
no more use of Puppet::Parser::Parser
[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
cb53ada
..
0c64b22
100644
(file)
--- a/
modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb
+++ b/
modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb
@@
-3,10
+3,8
@@
module Puppet::Parser::Functions
host = args[0]
yamlfile = args[1]
host = args[0]
yamlfile = args[1]
- parser = Puppet::Parser::Parser.new(environment)
- parser.watch_file(yamlfile)
- def read_yaml(yaml, host)
+ read_yaml = lambda { |yaml, host|
results = {}
['nameinfo', 'footer'].each do |detail|
results = {}
['nameinfo', 'footer'].each do |detail|
@@
-28,8
+26,7
@@
module Puppet::Parser::Functions
results['smarthost'] = ''
results['heavy_exim'] = ''
results['smarthost_port'] = 587
results['smarthost'] = ''
results['heavy_exim'] = ''
results['smarthost_port'] = 587
- results['reservedaddrs'] = '0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5'
-
+
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)
@@
-40,10
+37,9
@@
module Puppet::Parser::Functions
end
end
return(results)
end
end
return(results)
- end
+ }
require 'yaml'
require 'yaml'
- $KCODE = 'utf-8'
yaml = YAML.load_file(yamlfile)
ret = {}
yaml = YAML.load_file(yamlfile)
ret = {}
@@
-52,10
+48,10
@@
module Puppet::Parser::Functions
Dir.entries('/var/lib/puppet/yaml/node/').each do |fname|
next unless fname =~ /(.*)\.yaml$/
host_name = $1
Dir.entries('/var/lib/puppet/yaml/node/').each do |fname|
next unless fname =~ /(.*)\.yaml$/
host_name = $1
- ret[host_name] = read_yaml(yaml, host_name)
+ ret[host_name] = read_yaml
.call
(yaml, host_name)
end
else
end
else
- ret = read_yaml(yaml, host)
+ ret = read_yaml
.call
(yaml, host)
end
return(ret)
end
return(ret)