Issue #11450 has been updated by Brett Lentz.

Daniel Pittman wrote:
> Stefan Schulte wrote:
> > Is there a difference between an absent package (never installed or 
> > removed) and a purged package? Because in the described case the yum 
> > provider will return an is-value of :absent. Because the desired value is 
> > :purged puppet treat the resource as not-in-sync so removes the package 
> > again.
> > 
> > The dpkg package provider for example seems to return :purged for a package 
> > that is not installed, so it works on debian.
> > 
> > I guess we should either
> > 
> > * return an is value of :purged for an absent package
> > * modify insync so a value of :absent is treated as insync with a desired 
> > value of :purged
> 
> If that is the root cause of the problem - and `puppet resource package foo` 
> should tell you what Puppet extracts - then the later is the "right" 
> solution, albeit not necessarily trivial since it needs to vary by provider 
> in matching.
> 
> Brett, can you confirm by having an `ensure => purged` package on the system, 
> then adding the output of `puppet resource package foo` for it to the ticket?


I can confirm that yes, my puppet code is this:

package { 'abrt': ensure => purged }

Here's the output of 'puppet resource package abrt':

[root@REDACTED ~]# puppet resource package abrt
warning: Package kernel-devel found in both yum and yum; skipping the yum 
version
warning: Package kernel found in both yum and yum; skipping the yum version
warning: Package gpg-pubkey found in both yum and yum; skipping the yum version
warning: Package kernel-devel found in both yum and yum; skipping the yum 
version
warning: Package gpg-pubkey found in both yum and yum; skipping the yum version
warning: Package kernel found in both yum and yum; skipping the yum version
warning: Package gpg-pubkey found in both yum and yum; skipping the yum version
warning: Package gpg-pubkey found in both yum and yum; skipping the yum version
package { 'abrt':
  ensure => 'absent',
}
 
----------------------------------------
Bug #11450: Package provider improperly managing and logging purged resources
https://projects.puppetlabs.com/issues/11450

Author: Brett Lentz
Status: Needs More Information
Priority: Normal
Assignee: Daniel Pittman
Category: logging
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:

package { <package>: ensure => purged }

However, puppet prints this into the logs:

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


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.

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