Tim, > On Oct 14, 2015, at 10:14 PM, Tim Dunphy <bluethu...@gmail.com> wrote: > > Hey guys, > > On puppet server 3.8.2 here. And I have a file definition that I want to set > as 'absent'. For example, this is what I have: > > file { '/etc/newrelic/newrelic.cfg': > ensure => absent, > path => '/etc/newrelic/newrelic.cfg', > content => template('newrelic/newrelic.cfg.erb'), > before => Service[$newrelic_php_service], > notify => Service[$newrelic_php_service], > }
If you specify 'ensure => absent' then you should not have a 'content' line. They are contradictory parameters. (Also, but unrelated, the path parameter is duplicative since specifying the path as the file resource name serves the same purpose.) > And if I remove the file I want on the target host: > > [root@ops3:~] #rm -fv /etc/newrelic/newrelic.cfg > removed ‘/etc/newrelic/newrelic.cfg’ > > And then run the puppet agent again: > > [root@ops3:~] #puppet agent --test > Info: Retrieving pluginfacts > Info: Retrieving plugin > Info: Loading facts > Could not retrieve fact='nr_java_found', resolution='<anonymous>': undefined > method `start_with?' for nil:NilClass > Info: Caching catalog for ops3.jokefire.com <http://ops3.jokefire.com/> > Info: Applying configuration version '1444874991' > Notice: > /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]/ensure: > created > Info: /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]: > Scheduling refresh of Service[newrelic-daemon] > Notice: /Stage[main]/Newrelic::Agent::Php/Service[newrelic-daemon]: Triggered > 'refresh' from 1 events > Notice: /Stage[main]/Mcollective::Service/Service[mcollective]/ensure: ensure > changed 'stopped' to 'running' > Info: /Stage[main]/Mcollective::Service/Service[mcollective]: Unscheduling > refresh on Service[mcollective] > Notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed > 'stopped' to 'running' > Info: /Stage[main]/Apache::Service/Service[httpd]: Unscheduling refresh on > Service[httpd] > Notice: /Stage[main]/Puppet::Service/Service[puppet]/ensure: ensure changed > 'stopped' to 'running' > Info: /Stage[main]/Puppet::Service/Service[puppet]: Unscheduling refresh on > Service[puppet] > Notice: Finished catalog run in 7.17 seconds > > Notice the newrelic.cfg file that I want to be 'absent' is created > nontheless. > > Is this some kind of flaw in the version of puppet I'm using? Or could I be > doing something wrong? > > Because this is not at all the way I understand the 'absent' value of the > ensure setting is supposed to work! > > I guess in the meantime I can comment out the file definition entirely. But I > would like to understand why the 'absent' setting isn't working the way it's > supposed to! > > Thanks, > Tim -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/266E9C53-C845-474F-B3AD-54CA5D3D86B1%40gmail.com. For more options, visit https://groups.google.com/d/optout.