cron deleting not managed entries in some rare case

8 views
Skip to first unread message

ikkaro

unread,
Jun 26, 2017, 10:39:23 AM6/26/17
to Puppet Users
Hi,

Puppet it's deleting not managed lines in some cases. Best explained in this example:

This is an example manifest:

cron { 'logrotate':
  command => '/usr/sbin/test1',
  user    => 'zabbix',
  hour    => ['2-4'],
  minute  => '*/10',
}

cron { 'prueba2':
  command => '/usr/sbin/test2',
  user    => 'zabbix',
  hour    => ['2-4'],
  minute  => '*/10',
}


If I apply it the result is the one:

# Puppet Name: logrotate
*/10 2-4 * * * /usr/sbin/test1
# Puppet Name: prueba2
*/10 2-4 * * * /usr/sbin/test2


If you edit the cron manually and you add two entries, and comment some entry managed by puppet, like this:


*/10 2-4 * * * /usr/sbin/example1
# Puppet Name: logrotate
#*/10 2-4 * * * /usr/sbin/test1
# Puppet Name: prueba2
#*/10 2-4 * * * /usr/sbin/test2
*/10 2-4 * * * /usr/sbin/example2


And you execute the manifest:

/opt/puppetlabs/puppet/bin/puppet apply cron.pp
Notice: Compiled catalog for XXXXXXXXXXXXXX in environment production in 0.12 seconds
Notice: /Stage[main]/Main/Cron[logrotate]/ensure: created
Notice: /Stage[main]/Main/Cron[prueba2]/command: command changed '/usr/sbin/example2' to '/usr/sbin/test2'
Notice: Applied catalog in 0.26 seconds


You this this result: (example2 has been removed), this only happens when the not managed entry is present after the managed entries:

*/10 2-4 * * * /usr/sbin/example1
#*/10 2-4 * * * /usr/sbin/test1
#*/10 2-4 * * * /usr/sbin/test2
# Puppet Name: prueba2
*/10 2-4 * * * /usr/sbin/test2
# Puppet Name: logrotate
*/10 2-4 * * * /usr/sbin/test1

Reply all
Reply to author
Forward
0 new messages