Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
-
-
Night's Watch
-
1
-
NW - 2020-01-22
-
Needs Assessment
-
Bug Fix
-
The Yum package provider now accepts an array of strings to be specified for the `install_options` parameter in addition to the previous implementation which only accepted an array of hashes. Fix provided by community contributor Corey Osman.
-
Needs Assessment
Description
Puppet Version: Any
Puppet Server Version: Any
OS Name/Version: RHEL (All versions)
When using the puppet_agent module to update an RPM to the latest the install_options flags --enablerepo and --disablerepo only accepts array of hashes and not an array of Strings. This contradictory to the following documentation: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/package.rb#L36-L58
PR: Puppet 5.x: https://github.com/puppetlabs/puppet/pull/7879 and Puppet 6.x: {PR to come, will update when available}
Desired Behavior:
User's should be able to specify any package manager option as an array of String or an array of Hashes.
The docs detail the user can pass an array of strings or hashes. However, there are no tests in the puppet code base that back up these claims.
Actual Behavior:
Only --enablerepo and --disablerepo are special for YUM as they affect which packages are visible to the package manager. The logic that pulls them out for use in things like version checks only looks for Hash form of specifying an option: https://github.com/puppetlabs/puppet/blob/5.5.17/lib/puppet/provider/package/yum.rb#L268-L296
create a /tmp/test.pp file with the following contents:
- cat /tmp/test.pp
package { 'nginx': ensure => 'latest', install_options => [ '-enablerepo="dev*"' ], }
nginx can be any rpm package
Details show that an updated package was available and did not apply, contents of the manifest being applied:
root@:~
- yum list --enablerepo=dev nginx
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos
Installed Packages
nginx.x86_64 0.0.1.1111-1e8410a @dev-dev
Available Packages
nginxx86_64 0.0.1.1114-5e669d5 dev
root@:~
- cat /tmp/test.pp
package { 'nginx': ensure => 'latest', install_options => [ '-enablerepo="dev*"' ], }
root@:~
- puppet apply /tmp/test.pp
Notice: Compiled catalog for <hostname> in environment production in 0.02 seconds
Notice: Applied catalog in 2.11 seconds
Full puppet apply --debug /tmp/test.pp attached.