puppetlabs/puppet — pull request #2560 by adrienthebo (2014-04-21 21:03:47+00:00)
Title: PUP-1060 respect enablerepo and disablerepo when ensuring latest on yum packages

This pull request makes it possible to ensure a package at the latest version while specifying repositories to enable and disable. It makes the following modifications:

Latest package information is lazily fetched instead of being loaded at prefetch time. By making this lazy we decouple update querying and prefetching, update queries are donly done for packages that are ensured at latest, and have a given combination of repositories to enable and disable. We also memoize the result of any query with a combination of enablerepo and disablerepo flags, so queries are only done when needed and never done again.

When update information is looked up, --enablerepo and -disablerepo flags are pulled from the install_options parameter and used for the actual lookup. This means that using enablerepo and disablerepo is entirely transparent to end users; the right thing just happens behind the scenes. Since we don't require any special flags or parameters and just use install options, we can continue to use install_options for running the installation without modifying it.

Finally this updates the yumhelper.py to understand enablerepo and disablerepo.

In the short run modifying yumhelper.py will make the pull request work, but yumhelper.py has no unit testing and has other bugs (EG https://github.com/puppetlabs/puppet/pull/2473) that make it desirable to remove. `yum check-update` has been around for a long time and looks like it has the same output format from CentOS 4 on, so if this is the case we can probably switch to parsing the output of that command instead of trying to use pure python and falling back to `yum check-update`.