diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-14 01:32:37 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-14 01:32:37 +0000 |
commit | c67fb7b81d2fd69326b1518e0669164dcbf5773c (patch) | |
tree | a363c243b3a9da006714b320a8c140281648bb0c /lib | |
parent | ad9d3658470c175c46b55e37a005b338078a1d4e (diff) | |
download | puppet-c67fb7b81d2fd69326b1518e0669164dcbf5773c.tar.gz puppet-c67fb7b81d2fd69326b1518e0669164dcbf5773c.tar.xz puppet-c67fb7b81d2fd69326b1518e0669164dcbf5773c.zip |
Adding another host to the test lists, adding some test data, and modifying how hosts parse
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@828 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/puppet/type/parsedtype/host.rb | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/lib/puppet/type/parsedtype/host.rb b/lib/puppet/type/parsedtype/host.rb index 93d0a9002..3b83a0f54 100755 --- a/lib/puppet/type/parsedtype/host.rb +++ b/lib/puppet/type/parsedtype/host.rb @@ -31,7 +31,11 @@ module Puppet # We actually want to return the whole array here, not just the first # value. def should - @should + if defined? @should + return @should + else + return [] + end end validate do |value| @@ -84,13 +88,31 @@ module Puppet # add comments and blank lines to the list as they are @instances << line else - if match = /^(\S+)\s+(\S+)\s*(\S*)$/.match(line) - fields().zip(match.captures).each { |param, value| - hash[param] = value - } + if line.sub!(/^(\S+)\s+(\S+)\s*/, '') + hash[:ip] = $1 + hash[:name] = $2 + + unless line == "" + line.sub!(/\s*/, '') + line.sub!(/^([^#]+)\s*/) do |value| + aliases = $1 + unless aliases =~ /^\s*$/ + hash[:alias] = aliases + end + + "" + end + end else raise Puppet::Error, "Could not match '%s'" % line end + #if match = /^(\S+)\s+(\S+)\s*(\S*)\s*$/.match(line) + # fields().zip(match.captures).each { |param, value| + # hash[param] = value + # } + #else + # raise Puppet::Error, "Could not match '%s'" % line + #end if hash[:alias] == "" hash.delete(:alias) |