Uploaded image for project: 'Puppet Agent'
  1. Puppet Agent
  2. PA-1380

Puppet agent parse error on yum check-update output when using some yum plugins

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • puppet-agent 1.10.5
    • None
    • None
    • None
      • CentOS 7 x86_64
      • Yum Repositories provider Katello 3.4 (upstream project of Redhat Satellite 6)
      • Puppet agent: puppet-agent-1.10.5-1.el7.x86_64
    • Needs Assessment
    • Needs Assessment

    Description

      Some of yum plugins print some lines at the end of the yum check-updates command, eg:

      [root@foobar ~]# yum check-update
      Loaded plugins: enabled_repos_upload, fastestmirror, package_upload, product-id, search-disabled-repos, subscription-manager, tracer_upload
      CentOS_Linux_7_Base_-_x86_64                                                                                                                                                                               | 2.1 kB  00:00:00     
      CentOS_Linux_7_Extras_-_x86_64                                                                                                                                                                             | 2.5 kB  00:00:00     
      CentOS_Linux_7_Updates_-_x86_64                                                                                                                                                                            | 2.5 kB  00:00:00     
      EPEL_7_Base_-_x86_64                                                                                                                                                                                       | 2.1 kB  00:00:00     
      EL7_Internal_-_x86_64                                                                                                                                                                               | 2.1 kB  00:00:00     
      Puppet_4_EL7_PC1_-_x86_64                                                                                                                                                                                  | 1.8 kB  00:00:00     
      Loading mirror speeds from cached hostfile
       
      bind-libs.x86_64                                                                                       32:9.9.4-50.el7_3.1                                                                         CentOS_Linux_7_Updates_-_x86_64
      bind-libs-lite.x86_64                                                                                  32:9.9.4-50.el7_3.1                                                                         CentOS_Linux_7_Updates_-_x86_64
      bind-license.noarch                                                                                    32:9.9.4-50.el7_3.1                                                                         CentOS_Linux_7_Updates_-_x86_64
      bind-utils.x86_64                                                                                      32:9.9.4-50.el7_3.1                                                                         CentOS_Linux_7_Updates_-_x86_64
      glibc.x86_64                                                                                           2.17-157.el7_3.5                                                                            CentOS_Linux_7_Updates_-_x86_64
      glibc-common.x86_64                                                                                    2.17-157.el7_3.5                                                                            CentOS_Linux_7_Updates_-_x86_64
      java-1.8.0-openjdk.x86_64                                                                              1:1.8.0.141-1.b16.el7_3                                                                     CentOS_Linux_7_Updates_-_x86_64
      java-1.8.0-openjdk-headless.x86_64                                                                     1:1.8.0.141-1.b16.el7_3                                                                     CentOS_Linux_7_Updates_-_x86_64
      kernel.x86_64                                                                                          3.10.0-514.26.2.el7                                                                         CentOS_Linux_7_Updates_-_x86_64
      kernel-tools.x86_64                                                                                    3.10.0-514.26.2.el7                                                                         CentOS_Linux_7_Updates_-_x86_64
      kernel-tools-libs.x86_64                                                                               3.10.0-514.26.2.el7                                                                         CentOS_Linux_7_Updates_-_x86_64
      nagios-common.x86_64                                                                                   4.3.2-5.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins.x86_64                                                                                  2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-disk.x86_64                                                                             2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-load.x86_64                                                                             2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-mailq.x86_64                                                                            2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-nrpe.x86_64                                                                             3.1.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-perl.x86_64                                                                             2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-ping.x86_64                                                                             2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-procs.x86_64                                                                            2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nagios-plugins-users.x86_64                                                                            2.2.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      nrpe.x86_64                                                                                            3.1.1-1.el7                                                                                 EPEL_7_Base_-_x86_64           
      python-perf.x86_64                                                                                     3.10.0-514.26.2.el7                                                                         CentOS_Linux_7_Updates_-_x86_64
      tomcat-native.x86_64                                                                                   1.1.34-1.el7                                                                                EPEL_7_Base_-_x86_64           
      Uploading Enabled Reposistories Report
      Loaded plugins: fastestmirror, product-id
      

      When we try to ensure that a package is always at the latest version, the puppet run throw errors, eg:

      puppet apply --trace -e "package{[tzdata]: ensure => latest}"
      Notice: Compiled catalog for foobar.example.com in environment production in 0.09 seconds
      Error: Could not get latest version: undefined method `[]' for nil:NilClass
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:116:in `update_to_hash'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:96:in `block in parse_updates'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:93:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:93:in `each_slice'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:93:in `parse_updates'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:79:in `check_updates'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:52:in `latest_package_version'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb:220:in `latest'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/package.rb:160:in `block in insync?'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/package.rb:147:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/package.rb:147:in `insync?'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:277:in `safe_insync?'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:123:in `sync_if_needed'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:80:in `perform_changes'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:21:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:230:in `apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:246:in `eval_resource'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:163:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:163:in `block (2 levels) in evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:507:in `block in thinmark'
      /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:506:in `thinmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:163:in `block in evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:154:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:222:in `block in apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:155:in `with_destination'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:142:in `as_logging_destination'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:221:in `apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:171:in `block in apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:224:in `block in benchmark'
      /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `benchmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:170:in `apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:343:in `run_internal'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:221:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:306:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:195:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:350:in `apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:274:in `block in main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:306:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:225:in `main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:170:in `run_command'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:358:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:662:in `exit_on_fail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:358:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
      /opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
      Error: /Stage[main]/Main/Package[tzdata]/ensure: change from 2017b-1.el7 to latest failed: Could not get latest version: undefined method `[]' for nil:NilClass
      Notice: Applied catalog in 6.49 seconds
      

      This error is triggered when puppet try to parse the first line that don't describe a package update (the line "Uploading Enabled Reposistories Report" in the example)

      Applying the following patch solve the problem:

      diff /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/yum.rb.bak                 
      95,100c95
      <       # Skip lines with parsing error
      <       begin
      <         hash = update_to_hash(*tuple[0..1])
      <       rescue
      <         break
      <       end
      ---
      >       hash = update_to_hash(*tuple[0..1])
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bagasse Baptiste Agasse
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support