Issue #656 has been updated by Felix Frank.
Justin,
good find!
There is an easy fix for master, should apply to release versions too:
<pre>
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index 01f9bd9..86e2828 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -224,6 +224,12 @@ Puppet::Type.newtype(:cron) do
nil
end
end
+
+ def munge(value)
+ value.sub!(/^\s+/, '')
+ value.sub!(/\s+$/, '')
+ value
+ end
end
newproperty(:special) do
</pre>
I'm still working out how to write a good unit test for this. Then it will come
upstream.
My test manifest so far:
<pre>
$ RUBYLIB=lib puppet apply -e 'cron { "repeater": command => " /bin/true",
ensure => present }'
</pre>
----------------------------------------
Bug #656: cron entries with newlines keep being updated
https://projects.puppetlabs.com/issues/656#change-87579
* Author: Tobu -
* Status: Accepted
* Priority: Normal
* Assignee:
* Category: cron
* Target version:
* Affected Puppet version: 0.24.7
* Keywords: cronfixit
* Branch:
----------------------------------------
Here is the puppet snippet I use:
<pre>
class standalone-puppet {
$logdest = "/var/log/puppet/cron.log"
cron { hourly-puppet:
command => "/usr/bin/puppet \
--use-nodes /etc/puppet/manifests/site.pp \
--logdest $logdest",
user => root,
minute => 48,
}
}
</pre>
Every time puppet runs and updates the cronjob, on debian, it updates the cron
entry:
<pre>
notice: //default/standalone-puppet/Cron[hourly-puppet]/command: command
changed '/usr/bin/puppet --use-nodes /etc/puppet/manifests/site.pp --logdest
/var/log/puppet/cron.log' to '/usr/bin/puppet
--use-nodes /etc/puppet/manifests/site.pp --logdest
/var/log/puppet/cron.log'
</pre>
I'm not sure the problem is on puppet or crontab's side, but it would be nice
to prevent this.
Also, maybe there is a better technique for writing long strings - here
documents?
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.