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

New Parser does not handle hyphenated barewords

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 3.5.0
    • Component/s: DSL, Server
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Week 2014-2-26 to 2014-3-5

      Description

      The current parser/evaluator handles hyphenated bare words such as hi-there. The new parser and evaluator chokes on these, and tries to interpret them as numeric expressions of subtraction.

      Works on current parser:

      [16:08:41][Ruby(ruby-1.9.3-p448)][Git(pr/2320)] andy:puppet
      > be puppet apply -e 'notify { hi-there: }'
      Notice: Compiled catalog for aparker.corp.puppetlabs.net in environment production in 0.02 seconds
      Notice: hi-there
      Notice: /Stage[main]/Main/Notify[hi-there]/message: defined 'message' as 'hi-there'
      Notice: Finished catalog run in 0.03 seconds
      

      New evaluator shows that it is checking that the left and right operands of the - operator are numeric:

      [16:08:05][Ruby(ruby-1.9.3-p448)][Git(pr/2320)] andy:puppet
      > be puppet apply -e 'notify { hi-there: }' --parser future
      Error: Evaluation Error: The value 'hi' cannot be converted to Numeric. at line 1:10 on node aparker.corp.puppetlabs.net
      Error: Evaluation Error: The value 'hi' cannot be converted to Numeric. at line 1:10 on node aparker.corp.puppetlabs.net
      

      The current evaluator is passed it as a numeric expression as well.

      [16:08:13][Ruby(ruby-1.9.3-p448)][Git(pr/2320)] andy:puppet
      > be puppet apply -e 'notify { hi-there: }' --parser future --evaluator current
      Error: left operand of - is not a number at line 1 on node aparker.corp.puppetlabs.net
      Wrapped exception:
      left operand of - is not a number
      Error: left operand of - is not a number at line 1 on node aparker.corp.puppetlabs.net
      

      It appears that the new parser is tokenizing the hyphenated bare word as something like IDENTIFIER, SUBTRACT, IDENTIFIER where the old parser is seeing it as simply IDENTIFIER.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  andy Andrew Parker
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support