Bug #8102

parser cannot handle negative variable values for classes

Added by Andreas Roth 11 months ago. Updated 2 months ago.

Status:Closed Start date:06/26/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:2.7.9
Affected Puppet version:2.7.1 Branch:
Keywords:
Votes: 0

Description

The folloing code results in an error message:

class test($var = -3) {
}
class {
'test':
var => -5;
}

The error message is as follows: Could not parse for environment production: Syntax error at ‘–’; expected ‘)’ at /tmp/minus.pp:1 on node xxx

History

Updated by Nigel Kersten 11 months ago

You should be able to work around this by putting it in quotes.

Updated by Andreas Roth 11 months ago

I used the quotes to get my configuration running. But this issue is an inconsistency in the language, because i don’t have to use quotes for regular variables (e.g. global variables).

Updated by Nigel Kersten 11 months ago

  • Status changed from Unreviewed to Accepted
  • Target version set to 2.7.x

Oh absolutely. This shouldn’t be the case, I was just pointing out a workaround.

Updated by Jason Short 4 months ago

  • Status changed from Accepted to Closed

The following code works without errors on Puppet 2.7.9 on Ubuntu 11.10 (Ruby 1.8.7)

class test($var = -3) {
}
class {
'test':
var => -5;
}

Updated by Daniel Pittman 2 months ago

  • Target version changed from 2.7.x to 2.7.9

Also available in: Atom PDF