diff options
author | Markus Roberts <Markus@reality.com> | 2009-12-21 14:47:41 -0800 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-12-23 19:22:56 +1100 |
commit | 24654a22c2d172b23cb1133f65da4e5a2801de0a (patch) | |
tree | 055120863eebea2eaed9cc93f9642b7f95dd9fb5 /lib | |
parent | 49530adaaa302c4b4e3b9eefb05e9551503a0ba6 (diff) | |
download | puppet-24654a22c2d172b23cb1133f65da4e5a2801de0a.tar.gz puppet-24654a22c2d172b23cb1133f65da4e5a2801de0a.tar.xz puppet-24654a22c2d172b23cb1133f65da4e5a2801de0a.zip |
Making provider/host/parser.rb compatible with host_aliases
When I changed the alias property of hosts to host_aliases I missed
these changes in the parsed file provider.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/host/parsed.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/puppet/provider/host/parsed.rb b/lib/puppet/provider/host/parsed.rb index e6381384e..56caf8b74 100644 --- a/lib/puppet/provider/host/parsed.rb +++ b/lib/puppet/provider/host/parsed.rb @@ -17,8 +17,8 @@ Puppet::Type.type(:host).provide(:parsed, text_line :comment, :match => /^#/ text_line :blank, :match => /^\s*$/ - record_line :parsed, :fields => %w{ip name alias}, - :optional => %w{alias}, + record_line :parsed, :fields => %w{ip name host_aliases}, + :optional => %w{host_aliases}, :rts => true do |line| hash = {} if line.sub!(/^(\S+)\s+(\S+)\s*/, '') @@ -30,7 +30,7 @@ Puppet::Type.type(:host).provide(:parsed, line.sub!(/^([^#]+)\s*/) do |value| aliases = $1 unless aliases =~ /^\s*$/ - hash[:alias] = aliases.split(/\s+/) + hash[:host_aliases] = aliases.split(/\s+/) end "" @@ -40,8 +40,8 @@ Puppet::Type.type(:host).provide(:parsed, raise Puppet::Error, "Could not match '%s'" % line end - if hash[:alias] == "" - hash.delete(:alias) + if hash[:host_aliases] == "" + hash.delete(:host_aliases) end return hash @@ -58,11 +58,11 @@ Puppet::Type.type(:host).provide(:parsed, str = "%s\t%s" % [hash[:ip], hash[:name]] - if hash.include? :alias + if hash.include? :host_aliases if hash[:alias].is_a? Array - str += "\t%s" % hash[:alias].join("\t") + str += "\t%s" % hash[:host_aliases].join("\t") else - raise ArgumentError, "Aliases must be specified as an array" + raise ArgumentError, "Host aliases must be specified as an array" end end |