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

Yum provider using "version-release" to validate installation.


    • Template:


      When using yum provider Puppet complains(error output) when using only the version(string) of the package to install or installed at the time of verification.

          $snmp_version = ""
          package { "net-snmp": ensure => "${snmp_version}"; }
      Client output:
      debug: //Node[client.example.com]/snmp::base/Package[net-snmp]: Changing ensure
      debug: //Node[client.example.com]/snmp::base/Package[net-snmp]: 1 change(s)
      debug: Package[net-snmp](provider=yum): Ensuring =>
      **(1)** debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y install net-snmp-'
      **(2)** debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q net-snmp --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
      err: //Node[client.example.com]/snmp::base/Package[net-snmp]/ensure: change from to failed: Could not update: Failed to update to version, got version instead at /opt/git/development/modules/snmp/manifests/init.pp:26
      notice: //Node[client.example.com]/snmp::base/File[/etc/snmp/snmpd.conf]: Dependency package[net-snmp] has 1 failures
      warning: //Node[labtest40-v3.ea-colo.ea.com]/snmp::base/File[/etc/snmp/snmpd.conf]: Skipping because of failed dependencies

      The package is installed *(1)* but the error is still shown at the time of validation *(2)*, same situation if package is already installed.

      in .../provider/package/yum.rb:

      def install
          ---- chop lines ---
          is = self.query
          unless is
              raise Puppet::Error, "Could not find package %s" % self.name
          # FIXME: Should we raise an exception even if should == :latest
          # and yum updated us to a version other than @param_hash[:ensure] ?
          if should && should != is[:ensure]
              raise Puppet::Error, "Failed to update to version #{should}, got version #{is[:ensure]} instead"

      The error arises as *should* is not equal to *is[:ensure]*

      in .../provider/package/rpm.rb the query define comment says it will provide the *"version-release"*

      # Find the fully versioned package name and the version alone. Returns
      # a hash with entries :instance => fully versioned package name, and
      # :ensure => version-release
      def query

      The validation is made in the ensure attribute($snmp_version) string against "version-release" installed. It makes sense when somebody defines something like ensure => "${snmp_version}-${snmp-release}", but not in this use case.

      Tested in 0.24.8 but reported also on 0.25.4.

      rpm.rb and yum.rb are not behaving in the same way as yum cli behaves.


          Issue Links




                • Assignee:
                  redmine.exporter redmine.exporter
                  QA Contact:
                  Kurt Wall
                • Votes:
                  7 Vote for this issue
                  18 Start watching this issue


                  • Created: