Issue #11450 has been updated by Daniel Pittman.

Stefan Schulte wrote:
> is there a case where this similarity between absent and purged does not 
> apply? I haven't used debian for a while now but when you remove a package 
> (no purging = keep config files) can you later detect if the package was 
> removed the described way (puppet will set ensure to absent) or was removed 
> including configfiles (puppet will set ensure to purged)?

Yes.  Debian can distinguish the two cases, and actually does.  The goal here 
is that platforms (like `yum`) that don't distinguish the two states treat them 
as synonyms, but platforms that do (like `dpkg`) treat them as distinct.  (eg: 
more DWIM for the less capable platforms)

> if the answer is yes, is there a way to remove the configfiles after the 
> package itself was removed, so puppet can change ensure from :absent to 
> :purged?

Yes, Debian can purge and uninstall separately, and change from the later to 
the former.
----------------------------------------
Bug #11450: Package type and provider need to consider `purged` and `absent` 
packages identical for yum and similar providers
https://projects.puppetlabs.com/issues/11450

Author: Brett Lentz
Status: Accepted
Priority: Normal
Assignee: 
Category: package
Target version: 
Affected Puppet version: 2.6.12
Keywords: package purge
Branch: 


I have a package resource that I want to remove, including all of its 
dependencies. On Red Hat systems, this is done by "yum -y erase <package>". 

The corresponding puppet code is:

<pre>
package { <package>: ensure => purged }
</pre>

However, puppet prints this into the logs:

<pre>
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q abrt 
--nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} 
%{RELEASE} %{ARCH}
'
debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -y erase 
abrt'
notice: /Stage[main]/Global/Package[abrt]/ensure: created
</pre>

The notice is clearly incorrect, as there's nothing that's been created. In 
fact, it repeatedly prints this notice and runs the "yum erase" command long 
after the package has *actually* been removed. 

Both of these behaviors are incorrect, and are caused by the RAL returning 
`absent` as the package state, while `purged` is required for the resource to 
settle.

My expectation is:

1. Logged notices for purged resources should not describe anything as being 
"created".
2. Puppet should only run the "yum erase" command only if the package query 
("rpm -q") returns a valid result.



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