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

misleading error message with classname errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.0.0
    • Component/s: Language
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      • compiling a manifest where the class name is a String emits an error message that points to the actual error.
    • Epic Link:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDE 2017-05-31
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      handling of corner case - not release note worthy
    • QA Risk Assessment:
      Manual

      Description

      $ bundle exec puppet --version
      4.10.0
      $ bundle exec puppet apply -e "class 'foo' {}" --trace
      Error: Could not parse for environment production: 'class' is not a valid classname at line 1:1 on node davids
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/pops/parser/parser_support.rb:73:in `error'
      egrammar.ra:659:in `_reduce_190'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/pops/parser/lexer2.rb:712:in `scan'
      /usr/lib/ruby/2.3.0/racc/parser.rb:320:in `_racc_yyparse_c'
      /usr/lib/ruby/2.3.0/racc/parser.rb:320:in `yyparse'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/pops/parser/parser_support.rb:240:in `_parse'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/pops/parser/parser_support.rb:134:in `parse_string'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/pops/parser/evaluating_parser.rb:28:in `parse_string'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/parser/e4_parser_adapter.rb:29:in `parse'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/node/environment.rb:507:in `perform_initial_import'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/node/environment.rb:247:in `known_resource_types'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/parser/compiler.rb:766:in `block in initvars'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/context.rb:65:in `override'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet.rb:294:in `override'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/parser/compiler.rb:764:in `initvars'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/parser/compiler.rb:422:in `initialize'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/parser/compiler.rb:33:in `new'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/parser/compiler.rb:33:in `compile'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/indirector/catalog/compiler.rb:266:in `block (2 levels) in compile'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/util/profiler.rb:51:in `profile'
      /home/david/gems/ruby/2.3.0/gems/puppet-4.10.0/lib/puppet/indirector/catalog/compiler.rb:264:in `block in compile'
      [...]
      $ bundle exec puppet apply -e "class foo {}"
      Notice: Compiled catalog for davids in environment production in 0.06 seconds
      Notice: Applied catalog in 0.03 seconds
      $ 
      

      Putting a String, instead of a Classname into the manifest produces the misleading error message " 'class' is not a valid classname". Emitting " 'foo' is a String, not a class name", would be much more informative, and help the user to figure out what's going wrong.

      Interestingly, a define with the same mistake, will complain "Syntax error at 'foo' at line 1:8 on node davids", which is much more useful.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            david.schmitt David Schmitt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support