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

Obscure error messages caused by error in metadata.json of a module.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: PUP 4.3.1
    • Fix Version/s: None
    • Component/s: Modules
    • Template:
    • Acceptance Criteria:
      Hide

      The error messages should be more explicit; specifically that metadata.json in a module does not match an expected format/schema. This is not related to Facter (though from the output you can be mislead into believing it is).

      Show
      The error messages should be more explicit; specifically that metadata.json in a module does not match an expected format/schema. This is not related to Facter (though from the output you can be mislead into believing it is).
    • Team:
      Modules

      Description

      Context

      Introducing a new module in an existing and working puppet environment.

      Symptoms

      Running puppet agent fails with the following errors:

      # puppet agent --test
      Info: Using configured environment 'test'
      Info: Retrieving pluginfacts
      Error: /File[/opt/puppetlabs/puppet/cache/facts.d]: Failed to generate additional resources using 'eval_generate': Error 400 on SERVER: string not matched
      Error: /File[/opt/puppetlabs/puppet/cache/facts.d]: Could not evaluate: Could not retrieve file metadata for puppet:///pluginfacts: Error 400 on SERVER: string not matched
      Info: Retrieving plugin
      Error: /File[/opt/puppetlabs/puppet/cache/lib]: Failed to generate additional resources using 'eval_generate': Error 400 on SERVER: string not matched
      Error: /File[/opt/puppetlabs/puppet/cache/lib]: Could not evaluate: Could not retrieve file metadata for puppet:///plugins: Error 400 on SERVER: string not matched
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, string not matched at /etc/puppetlabs/code/environments/test/site.pp:8:1 on node testing.example.com
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      Error messages on the server log:

      # tail -f /var/log/puppetlabs/puppetserver/puppetserver.log
      ...
      2016-10-27 12:17:07,532 ERROR [qtp350972994-25856] [puppet-server] Puppet string not matched
      org/jruby/RubyString.java:3912:in `[]='
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/module.rb:158:in `load_metadata'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/module.rb:157:in `load_metadata'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/module.rb:151:in `load_metadata'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/module.rb:68:in `initialize'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/node/environment.rb:292:in `modules'
      org/jruby/RubyArray.java:2407:in `collect'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/node/environment.rb:290:in `modules'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/node/environment.rb:247:in `module'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/file_serving/mount/modules.rb:10:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/file_server.rb:29:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:194: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:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:240: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:42:in `handleRequest'
      Puppet$$Server$$Master_1414315869.gen:13:in `handleRequest'
      request_handler_core.clj:313:in `invoke'
      request_handler_core.clj:305:in `invoke'
      request_handler_core.clj:289:in `invoke'
      request_handler_service.clj:35: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:31:in `invoke'
      ring.clj:22:in `invoke'
      ring.clj:13:in `invoke'
      comidi.clj:267:in `invoke'
      ringutils.clj:98:in `invoke'
      ringutils.clj:54:in `invoke'
      ringutils.clj:60:in `invoke'
      ringutils.clj:110:in `invoke'
      jetty9_core.clj:408:in `invoke'
      

      Suspecting that the problem could be in the new module, I tried to build it and got this error:

      $ puppet module build
      Error: undefined method `split' for nil:NilClass
      Error: Try 'puppet help module build' for usage
      

      Cause

      There was a structure error in the metadata.json file of the new module.
      It was valid JSON but the dependencies setting was a list of strings instead of a list of hashes.

      Wrong dependencies list:

        "dependencies": ["other-module"],
      

      Solution

      Fixing the structure of the module's dependencies in metadata.json made the errors go away and it all worked again.

      Correct dependencies list.

        "dependencies": [
          {
            "name": "other-module"
          }
        ],
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            tiago Tiago TT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support