voxpupuli / puppet-yum

Puppet module for Yum
https://forge.puppet.com/puppet/yum
MIT License
16 stars 101 forks source link

yum::versionlock doesn't work as documented #334

Open vchepkov opened 2 months ago

vchepkov commented 2 months ago

on RHEL9, when trying to implement versionlock, catalog fails to compile

profile::yum::versionlock:
  - candlepin-0:4.4.10-1.el9.*
  - candlepin-selinux-0:4.4.10-1.el9.*

  if $versionlock {
    $versionlock.each | String $v| {
      yum::versionlock { $v: }
    }
  }

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Package name must be formatted as Yum::RpmName, not 'String'. See Yum::Rpmname documentation for details. (file: /opt/puppetlabs/server/data/puppetserver/filesync/client/versioned-dirs/puppet-code/production_90afc15b2dd89dcb859edafd5768f4efb3da9462/modules/yum/manifests/versionlock.pp, line: 80, column: 7) (file: /etc/puppetlabs/puppetserver/code/environments/production/site/profile/manifests/yum.pp, line: 39) on node foreman.chepkov.lan

The strings are created by dnf versionlock command
vchepkov commented 2 months ago

I have refactored, but imho, the previous parameters format should be accepted


profile::yum::versionlock:
  candlepin:
    version: 4.4.10
  candlepin-selinux:
    version: 4.4.10

  if $versionlock {
    $versionlock.each |String $package, Hash $attributes| {
      yum::versionlock { $package:
        * => $attributes,
      }
    }
  }