Issue #8138 has been updated by James Turnbull.

Status changed from Unreviewed to Needs More Information
Assignee set to Luke Kanies

Luke - any ideas? ParsedFile hurts my feelings.
----------------------------------------
Bug #8138: Puppet Host Resource purge file when encounter unknown entry 
(Parsefile)
https://projects.puppetlabs.com/issues/8138

Author: Nan Liu
Status: Needs More Information
Priority: Normal
Assignee: Luke Kanies
Category: host
Target version: 
Affected Puppet version: 2.6.9
Keywords: 
Branch: 


This is related to parsedfile and it's discovered when writing a provider 
against it. 

When parsedfile fails to process a line, instead of leaving it alone, it raises 
an error and throws away every record except for the resources in the catalog.

For example host file:
    127.0.0.1 localhost
    192.168.2.1 kermit
    badrecord

If we apply the following puppet resource it will purge the entire file and 
only leave kermit (remove localhost, badrecord):
    host { 'kermit':
      ip => '192.168.1.1',
    }

I can work around this issue by changing provider/host/parsed.rb:
     43     else
     44       #raise Puppet::Error, "Could not match '#{line}'"
     45       hash = {:ip => line, :name => ''}
     46     end

However it's really not the right solution since it simply silently ignore the 
parse problem. I've looked at parsedfile.rb, it appears to be related to the 
specific section below, but I'm not sure what needs to be changed in 
fileparsing.rb parse which invokes parse_line.

    249       begin
    250         @target = path
    251         return self.parse(text)
    252       rescue Puppet::Error => detail
    253         detail.file = @target
    254         raise detail
    255       ensure


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to