Looks like this could use a test. There's already tests for this in test/ral/providers/host/parsed.rb. Unfortunately 2 tests were already failing before your changes, but it looks like 3 tests fail now. At the very least that test should be fixed, and another one should probably be added to motivate the change in the implementation. I believe what I've heard is that as we touch these Test Unit files we're converting them to specs, so that would be nice. Matt
On Mon, Jun 21, 2010 at 10:20 AM, Nick Lewis <[email protected]> wrote: > The message was "host_aliases changed from 'absent' to ''". When reading > from > the hosts file, a host without aliases was considered to have "absent" > host_aliases. The host_aliases list is now considered to be present but > empty > if it is absent. > > Signed-off-by: Nick Lewis <[email protected]> > --- > lib/puppet/provider/host/parsed.rb | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lib/puppet/provider/host/parsed.rb > b/lib/puppet/provider/host/parsed.rb > index f3e7630..b881b62 100644 > --- a/lib/puppet/provider/host/parsed.rb > +++ b/lib/puppet/provider/host/parsed.rb > @@ -25,7 +25,9 @@ Puppet::Type.type(:host).provide(:parsed, > hash[:ip] = $1 > hash[:name] = $2 > > - unless line == "" > + if line.empty? > + hash[:host_aliases] = [] > + else > line.sub!(/\s*/, '') > line.sub!(/^([^#]+)\s*/) do |value| > aliases = $1 > @@ -41,7 +43,7 @@ Puppet::Type.type(:host).provide(:parsed, > end > > if hash[:host_aliases] == "" > - hash.delete(:host_aliases) > + hash[:host_aliases] = [] > end > > return hash > -- > 1.7.1 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<puppet-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
