Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-2934

Cron type wiping an existing crontab if it contains invalid entries

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: PUP 3.4.2, PUP 3.6.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      • Red Hat Enterprise Linux Server release 6.5
      • CentOS release 6.5
    • Template:

      Description

      When puppet runs on a crontab that has an invalid entry, all entries are removed and only the new puppet entries remain.

      Either puppet should not touch the existing entries or it should stop processing the file altogether and issue an error/warning

      [root@stditop ~]# cat c.pp
      cron { 'test':
        ensure => present,
        command => 'ls',
      }
       
      [root@stditop ~]# crontab -l
      * * * * * date > /tmp/date1
      * *  date > /tmp/date2
      [root@stditop ~]# puppet apply c.pp
      Notice: Compiled catalog for stditop.vm.super-visions.com in environment production in 0.11 seconds
      Error: Could not prefetch cron provider 'crontab': Could not parse line "* *  date > /tmp/date2" at root:3
      Notice: /Stage[main]/Main/Cron[test]/ensure: created
      Notice: Finished catalog run in 0.13 seconds
      [root@stditop ~]# crontab -l
      # HEADER: This file was autogenerated at Tue Jul 15 05:58:46 -0700 2014 by puppet.
      # HEADER: While it can still be managed manually, it is definitely not recommended.
      # HEADER: Note particularly that the comments starting with 'Puppet Name' should
      # HEADER: not be deleted, as doing so could cause duplicate cron jobs.
      # Puppet Name: test
      * * * * * ls
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                zipkid Stefan Goethals
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support