Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-10177

yum provider does not allow array of strings



    • Hide

      Considered fixed when install_options can pass an array of strings and array of hashes as arguments to install_options.

      Considered fixed when install_options can pass an array of strings and array of hashes as arguments to install_options.
    • 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


      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:

      1. 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:


      1. yum list --enablerepo=dev nginx
        Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos
        Installed Packages
        nginx.x86_64                                                                              @dev-dev
        Available Packages
        nginxx86_64                                                                             dev


      1. cat /tmp/test.pp
        package { 'nginx':   ensure          => 'latest',   install_options => [ '-enablerepo="dev*"' ], }


      1. 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. 




            gabriel.nagy Gabriel Nagy
            corey.osman Corey Osman
            0 Vote for this issue
            2 Start watching this issue



              Zendesk Support