Description: A (yum) package with versions containing epoch can cause unwanted behaviour when trying to install another version. It tries to downgrade when it should actually upgrade. This only happens when the version installed or the version we want to install is higher than the other only because of epoch (1:2.0 vs 5:1.0; if we strip down the epoch, all comparisons will have different results: 1.0 < 2.0). Root cause found to be in this code area. How to reproduce the issue: 1. Find a package that has a version higher than the other only because of epoch. Example:
> yum list python-docker-pycreds --show-duplicates
…
python-docker-pycreds.noarch 1.10.6-4.el7
python-docker-pycreds.noarch 1:0.3.0-7.el7
…
2. Simply install the two versions shown above in any order to get the issue:
> puppet resource package 'python-docker-pycreds' ensure='0.3.0-7.el7' provider='yum'
Notice: /Package[python-docker-pycreds]/ensure: created
package Unknown macro: { 'python-docker-pycreds'}
> puppet resource package 'python-docker-pycreds' ensure='1.10.6-4.el7' provider='yum'
Error: Could not update: Failed to update to version 1.10.6-4.el7, got version 1:0.3.0-7.el7 instead
Error: /Package[python-docker-pycreds]/ensure: change from '1:0.3.0-7.el7' to '1.10.6-4.el7' failed: Could not update: Failed to update to version 1.10.6-4.el7, got version 1:0.3.0-7.el7 instead
package Unknown macro: { 'python-docker-pycreds'}
OR
> puppet resource package 'python-docker-pycreds' ensure='1.10.6-4.el7' provider='yum'
Notice: /Package[python-docker-pycreds]/ensure: created
package Unknown macro: { 'python-docker-pycreds'}
> puppet resource package 'python-docker-pycreds' ensure='0.3.0-7.el7' provider='yum'
Error: Could not update: Failed to update to version 0.3.0-7.el7, got version 1.10.6-4.el7 instead
Error: /Package[python-docker-pycreds]/ensure: change from '1.10.6-4.el7' to '0.3.0-7.el7' failed: Could not update: Failed to update to version 0.3.0-7.el7, got version 1.10.6-4.el7 instead
package Unknown macro: { 'python-docker-pycreds'}
Here are some debug logs which prove that the comparison happened with epoch missing: Debug: Package[python-docker-pycreds](provider=yum): Downgrading package python-docker-pycreds from version 1.10.6-4.el7 to 0.3.0-7.el7 Debug: Executing: '/usr/bin/yum -d 0 -e 0 -y downgrade python-docker-pycreds-0.3.0-7.el7' Note: When installing versions that contain epoch, beware that certain yum versions won’t install the package unless the “epoch:” part is removed.
> puppet resource package 'python-docker-pycreds' ensure='1:0.3.0-7.el7' provider='yum'
Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install python-docker-pycreds-1:0.3.0-7.el7' returned 1: Error: Nothing to do Error: /Package[python-docker-pycreds]/ensure: change from 'purged' to '1:0.3.0-7.el7' failed: Could not update: Execution of '/usr/bin/yum d 0 -e 0 -y install python-docker-pycreds1:0.3.0-7.el7' returned 1: Error: Nothing to do
|