Force yum to remove a package?

2,095 views
Skip to first unread message

Duncan Hutty

unread,
Oct 1, 2012, 8:02:39 PM10/1/12
to puppet...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I want puppet to manage some packages. On CentOS, puppet correctly
uses the yum provider to manage rpms. Normally I can do:

package { ...:
ensure => present
}

but the rpms I want to install conflict with existing rpms.

Ok, you say. so "ensure => present" on the ones I want and "ensure =>
absent" on the ones to remove.

How do I cope with the fact that there are other installed packages
that depend on the ones I want to remove?

The new packages will fulfill the dependency as well, so effectively I
just want to force the transaction.

Effectively, I want puppet/yum to execute ``rpm -e --nodeps``; can I
tell puppet to do it that way? Or do I need to find a workaround, such
as an exec?


- --
Duncan Hutty
http://www.allgoodbits.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBp9t8ACgkQCFuTFybf1wrG/wCcD6uBPihYc4eXwql23ae4RUEr
WeoAoIWIdVv4XDi43S1hH73DjcEUMgGc
=BNC1
-----END PGP SIGNATURE-----

jcbollinger

unread,
Oct 1, 2012, 10:18:10 PM10/1/12
to puppet...@googlegroups.com, dhu...@allgoodbits.org


On Monday, October 1, 2012 3:02:48 PM UTC-5, Duncan Hutty wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I want puppet to manage some packages. On CentOS, puppet correctly
uses the yum provider to manage rpms. Normally I can do:

package { ...:
  ensure => present
}

but the rpms I want to install conflict with existing rpms.

Ok, you say. so "ensure => present" on the ones I want and "ensure =>
absent" on the ones to remove.

How do I cope with the fact that there are other installed packages
that depend on the ones I want to remove?

The new packages will fulfill the dependency as well, so effectively I
just want to force the transaction.


No, you never want to do that.  As soon as you do, you are no longer justified in having full confidence in your RPM database.  Probably things work out ok, if you've been careful, at least, but there are gotchas even for the careful.

The proper way to do this from the command line is to use "yum shell" to set up and run a transaction set that removes the unwanted RPMs and adds the replacements in the same go.  Or perhaps you can allow the dependant packages to be uninstalled and reinstalled (supposing they are all managed by Puppet, or you're willing to make them so).

 

Effectively, I want puppet/yum to execute ``rpm -e --nodeps``; can I
tell puppet to do it that way? Or do I need to find a workaround, such
as an exec?


The Package type does not provide a mechanism to specify additional flags for provider actions.  Furthermore, it manages packages one by one.  If you need to automate this switch via Puppet, then you probably do need an Exec.


John

Reply all
Reply to author
Forward
0 new messages