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

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

    Details

    • Template:

      Description

      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 = "5.3.2.2"
          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 => 5.3.2.2
      **(1)** debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y install net-snmp-5.3.2.2'
      **(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 5.3.2.2-7.el5_4.2 to 5.3.2.2 failed: Could not update: Failed to update to version 5.3.2.2, got version 5.3.2.2-7.el5_4.2 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
          end
          # 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"
          end
      

      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.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: