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

PuppetDB accepts newlines in resource titles but not relationship titles

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PDB 2.3.2
    • Fix Version/s: PDB 2.3.5
    • Component/s: Module
    • Labels:
    • Template:
    • Story Points:
      2
    • Sprint:
      PuppetDB 2015-05-20, PuppetDB 2015-06-03

      Description

      PuppetDB accepts catalog resources which contain newlines in their titles. However, if those same titles are used in a resource reference, validation fails and catalog compilation is aborted.

      Reproduction Case

      • Install PE 3.8.0.
      • Add the following to the default node declaration:x:

      exec{"/bin/echo -e \"hello,\nworld!\"":
        logoutput => true,
      }
       
      exec{'/bin/true':
        refreshonly => true,
        subscribe => Exec["/bin/echo -e \"hello,\nworld!\""],
      }
      

      • Attempt an agent run.

      Outcome

      The agent run fails with a PuppetDB error.

      [root@pe-380-master ~]# /opt/puppet/bin/puppet agent -t
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid relationship: Exec[/bin/true] { subscribe => Exec[/bin/echo -e "hello,
      world!"] }, because Exec[/bin/echo -e "hello,
      world!"] doesn't seem to be in the correct format. Resource references should be formatted as: Classname['title'] or Modulename::Classname['title'] (take careful note of the capitalization).
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      Here is the master backtrace:

      2015-05-15 20:51:13,280 ERROR [puppet-server] Puppet Invalid relationship: Exec[/bin/true] { subscribe => Exec[/bin/echo -e "hello,
      world!"] }, because Exec[/bin/echo -e "hello,
      world!"] doesn't seem to be in the correct format. Resource references should be formatted as: Classname['title'] or Modulename::Classname['title'] (take careful note of the capitalization).
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:280:in `synthesize_edges'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:263:in `synthesize_edges'
      org/jruby/RubyHash.java:1341:in `each'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:261:in `synthesize_edges'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:244:in `synthesize_edges'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler.rb:51:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/puppetdb.rb:108:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:242:in `synthesize_edges'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler.rb:51:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/puppetdb.rb:108:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:230:in `synthesize_edges'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:42:in `munge_catalog'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler.rb:51:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/puppetdb.rb:108:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:31:in `munge_catalog'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:12:in `save'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler.rb:51:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/puppetdb.rb:108:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/catalog/puppetdb.rb:11:in `save'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/store_configs.rb:24:in `save'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/indirector/indirection.rb:206:in `find'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/api/v1.rb:105:in `do_find'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/api/v1.rb:50:in `call'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/context.rb:64:in `override'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet.rb:244:in `override'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/api/v1.rb:49:in `call'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/route.rb:82:in `process'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/route.rb:81:in `process'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/handler.rb:63:in `process'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/util/profiler.rb:51:in `profile'
      /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/network/http/handler.rb:61:in `process'
      file:/opt/puppet/share/puppetserver/puppet-server-release.jar!/puppet-server-lib/puppet/server/master.rb:38:in `handleRequest'
      

      Expected Outcome

      PuppetDB accepts all valid resource titles as valid relationship titles.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  russell.mull Russell Mull
                  Reporter:
                  chuck Charlie Sharpsteen
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: