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

Race condition exists when cron resource specified but cron is not installed and gets installed by puppet

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 5.3.6, PUP 6.1.0
    • Fix Version/s: None
    • Component/s: None
    • Template:
      PUP Bug Template
    • Team:
      Platform OS
    • Method Found:
      Needs Assessment
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: All tested (latest)
      Puppet Server Version: 4, 5, 6.1.0
      OS Name/Version: Centos 6/7

      When a system does not have a cron handler installed, but the manifest installs cron and then installs a cron entry for a user, the cron entry will NOT get added to the user but instead to root. If you run again it will install for the user. This is obviously not intended and can potentially create a security risk (as cronjobs will run as root unintended). More importantly, it breaks stuff.

      Here is a sample that you can replace your site.pp with and run against an agent to reproduce:

      # Make sure cronie is NOT installed (or any cron provider) for the sample race condition.
      package { 'cronie':
        ensure => installed,
      }
       
      cron { 'race_condition_test':
        ensure => present,
        user => 'nobody', # This can be any user as long as they exist.
        minute => '*/30',
        command => '/bin/false',
        require => Package['cronie'],
      }
      

      The first time you run this it will install cronie, and install this crontab under root.
      Every time you run after it will install / verify the cron entry exists for the user 'nobody'.

       

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                jmarcelletti Joseph Marcelletti
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: