ipAddrs = args[0]
yamlfile = args[1]
+ parser = Puppet::Parser::Parser.new(environment)
parser.watch_file(yamlfile)
- $KCODE = 'utf-8'
-
ans = {"name" => "unknown"}
yaml = YAML.load_file(yamlfile)
ipAddrs.each do |addr|
yaml.keys.each do |hoster|
- if yaml[hoster].kind_of?(Hash) and yaml[hoster].has_key?('netrange')
- netrange = yaml[hoster]['netrange']
- else
- next
- end
+ next unless yaml[hoster].kind_of?(Hash) and yaml[hoster].has_key?('netrange')
+ netrange = yaml[hoster]['netrange']
netrange.each do |net|
begin
end
end
end
+ if not ans['longname']
+ ans['longname'] = ans['name']
+ end
return ans
end
end