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

yum provider does not allow array of strings

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 5.y, PUP 6.y
    • Fix Version/s: PUP 6.13.0
    • Component/s: None
    • Template:
      PUP Bug Template
    • Acceptance Criteria:
      Hide

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

      Show
      Considered fixed when install_options can pass an array of strings and array of hashes as arguments to install_options.
    • Team:
      Night's Watch
    • Story Points:
      1
    • Sprint:
      NW - 2020-01-22
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      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.
    • QA Risk Assessment:
      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:

      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:

      root@:~

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

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

      root@:~

      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. 

        Attachments

          Activity

            People

            • Assignee:
              gabriel.nagy Gabriel Nagy
              Reporter:
              corey.osman Corey Osman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support