Bug #11383

cron type and provider only return resources for ENV["USER"] or "root", not all users

Added by Nick Jenkin 5 months ago. Updated 4 months ago.

Status:Accepted Start date:12/13/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:cron
Target version:2.7.x
Affected Puppet version: Branch:
Keywords:
Votes: 2

Description

When using resources { cron: purge => true }, only the root users crontab is purged.

This works:

cron {"foo":
        command => "ls",
        ensure => present,
        user => root,
}

(and then proceed to comment the above out): notice: /Cron[foo]/ensure: removed

This does not work:

cron {"bar":
        command => "ls",
        ensure => present,
        user => nick,
}

This crontab will still exist if commented out.

Broken in 2.6 and latest stable.

History

Updated by Nick Jenkin 5 months ago

Note: using CentOS

This may be related:

The command “puppet resource cron” only returns the cron resources for the currently logged in user.

I suspect puppet is only provided with the cron entries of the currently logged in user, as opposed to every user.

Updated by Daniel Pittman 5 months ago

  • Subject changed from cron resource purge only occurs on the root user to cron type and provider only return resources for ENV["USER"] or "root", not all users
  • Description updated (diff)
  • Category set to cron
  • Status changed from Unreviewed to Accepted

The root cause, indeed, is that we only discover instances for one user, defaulting to ENV["USER"] or root if that is not set in the agent environment. The purge operation will only work on what the provider itself returns.

Thanks for the report; I have verified that we can reproduce it here.

Updated by Michael Stahnke 4 months ago

  • Target version changed from 2.6.x to 2.7.x

2.6.x is closed. Moving to 2.7.x

Also available in: Atom PDF