On Tuesday, April 22, 2014 2:16:22 PM UTC-5, Jon Forrest wrote:
>
> (I found a discussion from 6/22/09 on this topic, but that was a long time
> ago.)
>
Did the discussion give you reason to think that the behavior was
unintentional or likely to change?
>
> Using Puppet 3.5.1 on CentOS 6.5 I recently created the following:
>
> package {
> [ "PackageKit"]:
> ensure => absent,
> }
>
> However, when I ran Puppet, I got
>
> Error: Execution of '/bin/rpm -e PackageKit-0.5.8-21.el6.x86_64' returned
> 1: error: Failed dependencies:
> PackageKit = 0.5.8-21.el6 is needed by (installed)
> PackageKit-yum-0.5.8-21.el6.x86_64
> PackageKit = 0.5.8-21.el6 is needed by (installed)
> PackageKit-glib-0.5.8-21.el6.x86_64
> PackageKit is needed by (installed)
> PackageKit-yum-plugin-0.5.8-21.el6.x86_64
>
> Notice that the provider is running '/bin/rpm' which explains the errors.
>
Yes, this is intentional. Puppet is taking care to avoid undeclared side
effects. Such side effects can make your manifest set inconsistent in ways
that Puppet cannot otherwise detect. For example, suppose somewhere else
in your manifest set you had
package { "PackageKit-yum": ensure => 'installed' }
That declaration and your example declaration are not consistent with each
other, but if Puppet provided for ensure => absent via yum then both could
be applied without error. The result would depend on the relative order in
which the declarations were applied, but neither result would be fully
consistent with the catalog.
> So, I explicitly added
> a provider, so that the resource definition is this:
>
> package {
> [ "PackageKit"]:
> provider => 'yum',
> ensure => absent,
> }
>
> There was no change!!
>
>
No, because the agent was selecting the yum provider already. The yum
provider ensures absent by use of 'rpm -e'. Again, this is intentional.
In the discussion from 2009, somebody suggested using "purge" instead of
> "absent",
> so I did.
>
And if you are willing to accept the risk of inconsistency described above,
then that is what you should do. But it's spelled "purged", not "purge".
> But although Puppet now uses yum, it does so in a very strange way:
>
> Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install
> PackageKit-purge' returned 1: Error: Nothing to do
> Wrapped exception:
>
> This looks like a bug to me.
>
You misspelled "purged" for your 'ensure' parameter, and therefore Puppet
interpreted it as a package version.
>
> I ended up using
>
> exec { "/usr/bin/yum -y remove PackageKit":
> onlyif => "/bin/rpm -qa |/bin/fgrep PackageKit",
> }
>
> but this is a step in the wrong direction.
>
> Comments?
>
>
You are looking for this:
package { 'PackageKit':
ensure => 'purged'
}
John
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/2d843390-3f31-40cb-87f6-359057ba0df2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.