Issue #1798 has been updated by Brian Dunbar.

Status changed from Closed to Re-opened

While this is not often used, having the ability to enforce 'purge all but 
puppet-managed resources' does have legitimate uses.

I'd like to see resource type needs an ensure => absent option that works the 
same as the other resources ensure => absent.

I can devote some time to a patch, however a) I don't know ruby well at all and 
b) on my todo list it's necessarily a low-priority item. 
----------------------------------------
Bug #1798: Fix to allow resources {service: purge => true}...
https://projects.puppetlabs.com/issues/1798#change-73519

Author: Ido Rosen
Status: Re-opened
Priority: Normal
Assignee: Nigel Kersten
Category: 
Target version: 
Affected Puppet version: 0.24.6
Keywords: 
Branch: 


The service resource type needs an ensure => absent option so that it is 
compatible with purging of unmanaged entries.  Here's a patch to add an alias 
for it.  I've tested this patch.  In lieu of changing the way purging of 
unmanaged entries works, perhaps there should be a requirement that types 
support ensure => absent?

resources { service: purge => true } # will disable all services not explicitly 
enabled in your manifest after applying this patch, ensuring only the services 
you want running are indeed running...

Here's the patch:
<pre>
diff --recursive --unified puppet-0.24.6.orig/lib/puppet/type/service.rb 
puppet-0.24.6/lib/puppet/type/service.rb
--- puppet-0.24.6.orig/lib/puppet/type/service.rb       2008-07-08 
09:46:19.000000000 -0400
+++ puppet-0.24.6/lib/puppet/type/service.rb    2008-12-05 12:25:03.000000000 
-0500
@@ -64,6 +64,10 @@
             aliasvalue(:false, :stopped)
             aliasvalue(:true, :running)
 
+            # in order to make resources { service: purge => true } work 
+           # properly every type should support ensure => absent.
+            aliasvalue(:absent, :stopped)
+
             def retrieve
                 return provider.status
             end
</pre>


-- 
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