Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-2007

munging catalog fails with :undef tags

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 3.2.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      2
    • Sprint:
      PuppetDB 2015-10-21

      Description

      In 2015.2, if you have an undef tag on a resource an error occurs during munging that causes the agent run to fail. I'm not sure whether that bit of code is owned by the puppetdb team, so this ticket may need to be moved.

      I'm also not sure whether this is expected behavior. We set a lot of variables to undef so if undef tags break things we may need to touch a lot of code.

      From the agent side, it looks like:

      root@pl-files02-dev:/etc/puppetlabs/puppet# p
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: comparison of String with :undef failed
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      In the puppetserver logs, the error looks like:

      2015-09-29 13:14:21,082 INFO  [puppet-server] Puppet Compiled catalog for i-852af54c in environment production in 10.89 seconds
      2015-09-29 13:14:21,082 INFO  [puppet-server] Puppet Caching catalog for i-852af54c
      2015-09-29 13:14:21,209 ERROR [puppet-server] Puppet comparison of String with :undef failed
      org/jruby/RubyArray.java:3358:in `sort!'
      org/jruby/RubyArray.java:3332:in `sort'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:203:in `sort_unordered_metaparams'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:201:in `sort_unordered_metaparams'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:199:in `sort_unordered_metaparams'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/puppetdb.rb:89:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:197:in `sort_unordered_metaparams'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:46:in `munge_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/puppetdb.rb:89:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:36:in `munge_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:12:in `save'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/puppetdb.rb:89:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:11:in `save'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/store_configs.rb:24:in `save'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:199:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:134:in `do_find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:48:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:47:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:82:in `process'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:81:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:60:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:58:in `process'
      file:/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/puppet-server-lib/puppet/server/master.rb:39:in `handleRequest'
      Puppet$$Server$$Master_1793991858.gen:13:in `handleRequest'
      request_handler_core.clj:274:in `invoke'
      request_handler_service.clj:14:in `handle_request'
      request_handler.clj:3:in `invoke'
      request_handler.clj:3:in `invoke'
      core.clj:626:in `invoke'
      core.clj:2468:in `doInvoke'
      master_core.clj:47:in `invoke'
      ring.clj:22:in `invoke'
      ring.clj:13:in `invoke'
      comidi.clj:267:in `invoke'
      ringutils.clj:106:in `invoke'
      ringutils.clj:62:in `invoke'
      ringutils.clj:68:in `invoke'
      ringutils.clj:118:in `invoke'
      legacy_routes_core.clj:114:in `invoke'
      legacy_routes_core.clj:94:in `invoke'
      

      It looks like around like 203 of Puppet::Resource::Catalog::Puppetdb during munging of the catalog to send it to puppetdb, it attempts to sort and cannot because ruby's enumerable can't compare symbols (:undef) to the string values of the rest of the tags.

      The relevant puppet code that triggered this was:

        @@concat::fragment { "${::certname}_ecdsakey":
          target  => $known_hosts,
          content => join( $ssh_key_concat, ' ' ),
          tag     => [ $env_tag, $worker_tag, 'zpr_sshkey' ],
        }
      

      The $env_tag variable was set to undef, which worked with older PE but (apparently) not 2015.2.

      Thanks to Charlie Sharpsteen for doing most of the work of figuring this out.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                daniel.dreier Daniel Dreier
                QA Contact:
                Kurt Wall
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: