Issue #9440 has been updated by Jeremy Thornhill. File patch added
Matthaus, I suspected that the destruction was related to #8138, but fixing that bug would only cause this failure to be less annoying. The fact is that the syntax above *should parse properly* to be compatible with documented vixie-cron syntax. The cron provider needs to understand that leading whitespace is valid for comments and environment variables, as per the vixie-cron documentation. Keep in mind that this already works with cron job entries themselves thanks to #1216, but not variables or comments. Specifically, in crontab.rb, one sees that record_line :crontab allows for leading whitespace, but text_line :comment and :environment do not. I'm including an (untested) patch that shows what might need to be changed here. I don't know much about parsedfile so I'm just guessing based on the existing (proper) entry for record_line :crontab ---------------------------------------- Bug #9440: Puppet destroys crontab files which contain whitespace before variables or comments https://projects.puppetlabs.com/issues/9440 Author: Jeremy Thornhill Status: Duplicate Priority: Normal Assignee: Matthaus Litteken Category: cron Target version: 2.7.x Affected Puppet version: Keywords: cron Branch: I believe I've encountered a regression (or a corner case that was not fixed) from #1216. Agent and master are both version 2.7.1, cron is vixie-cron. One of our SAs copied in some variables from an old crontab, and during the process he introduced leading whitespace. Such lines should not be treated as syntax errors as per the vixie-cron documentation (the leading spaces are supposed to be simply ignored). The crontab he created has leading whitespace (four spaces) before a variable assignment, which precedes a valid non-indented cronjob: <pre> FOO=bar 5 0 * * * /usr/local/bin/myjob </pre> Puppet behaves really badly in this case; first it gives the following error: <pre> err: Could not prefetch cron provider 'crontab': Could not parse line " FOO=bar" at root:2 </pre> and then, it proceeds to discard everything in the existing crontab (#8138 ?), with the resulting crontab containing only the entries that are actually defined in puppet. Note that this behavior seems to only happen with indented comments or variable assignments. If you indent the actual cron job entry itself, the parser handles that properly. -- 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.
