Issue #11383 has been updated by Felix Frank.

Here's a silly little patch that addresses this.

<pre>
diff --git a/lib/puppet/provider/cron/crontab.rb 
b/lib/puppet/provider/cron/crontab.rb
index 304a1ff..54f7f54 100644
--- a/lib/puppet/provider/cron/crontab.rb
+++ b/lib/puppet/provider/cron/crontab.rb
@@ -241,5 +241,17 @@ Puppet::Type.type(:cron).provide(:crontab, :parent => 
Puppet::Provider::ParsedFi
   def user
     @property_hash[:user] || @property_hash[:target]
   end
+
+  # Include all plausible crontab files on the system
+  # in the list of targets (#11383)
+  def self.targets(resources = nil)
+    targets = super(resources)
+    Etc.passwd do |user|
+      crontab = "/var/spool/cron/crontabs/#{user.name}"
+      targets << user.name
+    end
+    targets.uniq
+  end
+
 end
</pre>

It breaks at least four unit tests though, of which at least two are protecting 
us quite specifically against the parsing of "foreign" crontabs. Go figure...

----------------------------------------
Bug #11383: cron type and provider only return resources for ENV["USER"] or 
"root", not all users
https://projects.puppetlabs.com/issues/11383#change-99906

* Author: Nick Jenkin
* Status: Accepted
* Priority: Normal
* Assignee: Nigel Kersten
* Category: cron
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
When using resources { cron: purge => true }, only the root users crontab is 
purged.

This works:
<pre>
cron {"foo":
        command => "ls",
        ensure => present,
        user => root,
}
</pre>

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

This does not work:
<pre>
cron {"bar":
        command => "ls",
        ensure => present,
        user => nick,
}
</pre>

This crontab will still exist if commented out.

Broken in 2.6 and latest stable.


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to