Issue #3220 has been updated by Nigel Kersten.

Subject changed from err: //crontab::cleaner/Resources[cron]: Failed to 
generate additional resources using 'generate' to cron provider doesn't purge 
puppet-created cron resources correctly.

Rob Terhaar wrote:
> The goal of puppet resource purge is twofold, imho:
> 
> 1. to decruft old puppet-created resources
> 2. to prevent people from manually tinkering with systems
> 
> 
> So, to answer your question Nigel, yes! Puppet's "resources" resource should 
> remove both puppet-created entries and manually created entries!

That's pretty much impossible with the current provider and the reliance upon 
special comment lines :(

We are aiming to produce an /etc/cron.d provider in #746 that will allow this 
functionality. I'm attaching my defined resource that I use for this to the 
ticket in case anyone else finds it useful, but we're going to make a native 
one.

I'm going to target this bug at trying to purge the Puppet-created entries, but 
it's really not feasible to deal with manually created entries.


----------------------------------------
Bug #3220: cron provider doesn't purge puppet-created cron resources correctly.
https://projects.puppetlabs.com/issues/3220

Author: Rob Terhaar
Status: Needs More Information
Priority: Normal
Assignee: Todd Zullinger
Category: cron
Target version: 
Affected Puppet version: 0.25.4
Keywords: 
Branch: 


Hello-

Bit of background first, we're using CentOS5 machines with puppet/puppetmaster 
25.4 from EPEL packages.
 
For some reason that I cannot determine, the following code[1] (which works on 
our development system) fails[2] on our staging system:

[1]
class crontab::cleaner {
  resources { cron: purge => true }
}

Our intent is to remove all non-managed crontab entries. 

However, when I run puppetd --test, I receive this error:

err: //crontab::cleaner/Resources[cron]: Failed to generate additional 
resources using 'generate': You must specify a name or title for resources

--trace --debug --verbose on puppetmaster and on the puppetd client[3] do not 
give any further information about the problem.

[3]
debug: Creating default schedules
debug: Finishing transaction -607717888 with 0 changes
debug: Loaded state in 0.01 seconds
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1054:in `hash2resource'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1888:in `initialize'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1016:in `new'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1016:in `instances'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1006:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1006:in `instances'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1005:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1005:in `instances'
/usr/lib/ruby/site_ruby/1.8/puppet/type/resources.rb:101:in `generate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:349:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:349:in 
`generate_additional_resources'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:378:in `generate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:377:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:377:in `generate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:493:in `prepare'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:284:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/1.8/sync.rb:229:in `synchronize'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in `with_client'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in `onetime'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
err: //crontab::cleaner/Resources[cron]: Failed to generate additional 
resources using 'generate': You must specify a name or title for resources
debug: Prefetching parsed resources for sshkey
debug: Prefetching crontab resources for cron
debug: Prefetching yum resources for package
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm --version'



-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to