-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package: pacman provider: Add purgeable feature #9287
Conversation
Can one of the admins verify this patch? |
I did some local testing and this works as expected: # puppet resource package htop ensure=purged --debug
Debug: Prefetching pacman resources for package
Debug: Executing '/usr/bin/pacman -Q'
Debug: Executing '/usr/bin/pacman -Sgg'
Debug: Executing: '/usr/bin/pacman -Sg htop'
Debug: Executing: '/usr/bin/pacman --noconfirm --noprogressbar -R --nosave htop'
Notice: /Package[htop]/ensure: purged
Debug: Finishing transaction 10180
Debug: Storing state
Debug: Pruned old state cache entries in 0.00 seconds
Debug: Stored state in 0.01 seconds
Debug: Executing '/usr/bin/pacman -Q'
Debug: Executing '/usr/bin/pacman -Sgg htop' |
@@ -25,6 +25,7 @@ def self.yaourt? | |||
has_feature :uninstall_options | |||
has_feature :upgradeable | |||
has_feature :virtual_packages | |||
has_feature :purgeable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't even required and somehow automatically enabled when a purge
method exists? but some providers explicitly enable it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, since the package
type defines the purgeable
feature as depending on the purge
method
puppet/lib/puppet/type/package.rb
Lines 47 to 51 in 12cc9e6
feature :purgeable, "The provider can purge packages. This generally means | |
that all traces of the package are removed, including | |
existing configuration files. This feature is thus destructive | |
and should be used with the utmost care.", | |
:methods => [:purge] |
Then it is not strictly necessary to specify has_feature
due to the available
check in
puppet/lib/puppet/util/provider_features.rb
Line 156 in 12cc9e6
(is_a?(Class) ? declared_feature?(name) : self.class.declared_feature?(name)) or feature.available?(self) |
This small patch adds an option to the pacman provider to purge config files. From the manpage: ```console $ pacman -R -h | head -n6 usage: pacman {-R --remove} [options] <package(s)> options: -b, --dbpath <path> set an alternate database location -c, --cascade remove packages and all packages that depend on them -d, --nodeps skip dependency version checks (-dd to skip all checks) -n, --nosave remove configuration files ```
I added a test and they seem to pass? Let me know if this is what you had in mind. |
Thanks @bastelfreak ! |
Thanks! Any chance this can go into 7 as well? I can provide a new PR if you like. |
Successfully created backport PR for |
This small patch adds an option to the pacman provider to purge config files.
From the manpage: