On Monday, April 6, 2015 at 12:05:09 PM UTC-5, staceyt...@gmail.com wrote: > > Hi all, > > I am trying to use puppet to downgrade my gdm package from 64 to 39, but > got package dependency problem: > > Here is my class: > > class gdmver39 { > yumrepo { 'custom': > baseurl => 'file:/home/admin/REPO/WS6.4', > enabled => 1, > } > > package { "gdm-libs": ensure => '2.30.4-39.el6', require => > Yumrepo["custom"] } > package { "gdm-plugin-fingerprint": ensure => '2.30.4-39.el6', require > => Yumrepo["custom"] } > package { "gdm": ensure => '2.30.4-39.el6', require => Yumrepo["custom"] > } > } > > I think myabe i should add the parameter below to my 'gdm' line'? > > require Package['gdm-libs', 'gdm-plugin-fingerprint'] > > How to tell puppet to handle the dependency automatically? > >
Supposing that you have RPM dependencies requiring exact version-release matches among those packages, it is unlikely that you can perform such a downgrade via those Package resources alone. Puppet operates by transitioning one resource at a time from its initial state to its final state, and none of those packages can be transitioned independently, in one step, from its current release to an earlier one. Even to do it manually you would need either to remove some of those packages first, and then later install the desired version, or else use the yum shell to set up the whole thing as one transaction. If there is only one release (i.e. 64) from which you wanted to downgrade, then it would be easier, but your class naming leads me to think that you want to downgrade from *any* later release that might be installed. That's going to require you to determine exactly which version and release is installed prior to each run. A custom fact would serve that purpose. Supposing you created such a custom fact as $::gdm_version_release, you should then be able to do this: class gdmver39 { yumrepo { 'custom': baseurl => 'file:/home/admin/REPO/WS6.4', enabled => 1, } if $::gdm_version_release and (versioncmp($::gdm_version_release, '2.30.4-39.el6') > 0) { package { "gdm-${::gdm_version_release}": ensure => 'purged', before => Package['gdm-libs'] } } package { "gdm-libs": ensure => '2.30.4-39.el6', require => Yumrepo[ "custom"] } package { "gdm": ensure => '2.30.4-39.el6', require => Package['gdm-libs'] } package { "gdm-plugin-fingerprint": ensure => '2.30.4-39.el6', require => Package['gdm'] } } BE WARNED: ensuring a yum package 'purged' will remove not only that package, but also any others that depend on it. In this case that intentionally includes gdm-plugin-fingerprint, but if I ran that on one of my systems it would also remove about three other packages as well. The gdm and gdm-plugin-fingerprint would later be reinstalled, but nothing I presented ensures the same for the others. If you want to avoid the mess surrounding package purging (as most sane people would), then you could replace it with an Exec that uses 'yum shell' to perform the downgrade. That's messier in Puppet, but cleaner with respect to package management. You'll want to work out the details for yourself to ensure they are right for your environment, but you would probably want to redirect a series of commands similar to this into yum shell: downgrade gdm-2.30.4-39.el6 downgrade gdm-libs-2.30.4-39.el6 downgrade gdm-plugin-fingerprint-2.30.4-39.el6 ts run In Puppet, such an Exec should be set up to require the appropriate repo. When it is needed, it may be used either instead of or before the package resources. Note also that if you're not actually using fingerprint readers with any of these systems, and don't anticipate wanting to do so in the foreseeable future, then you could make this issue a little simpler by ensuring yum-plugin-fingerprint 'absent'. I know it's installed by default in EL6, but most sites don't need it. Personally, I avoid ever installing it in the first place. 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b593ffac-14bc-45bc-a009-d5810070056d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.