Bug #4685

Classes, defines, and nodes allowed inside of non-evaluated conditionals

Added by Paul Berry over 1 year ago. Updated 7 months ago.

Status:Closed Start date:09/01/2010
Priority:Normal Due date:
Assignee:Jesse Wolfe % Done:

100%

Category:parser
Target version:2.7.0
Affected Puppet version:development Branch:http://github.com/reductivelabs/puppet/tree/next
Keywords:
Votes: 0

Description

The fix for issue #4522 introduced an error message if the user tries to declare a class, node, or define inside of a conditional construct. However, the error is only raised if the conditional code is actually evaluated. For example, this code generates an error (as expected):

if true {
  class foo { }
}

but this code does not:

if false {
  class bar { }
}

History

Updated by Paul Berry over 1 year ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • % Done changed from 0 to 100
  • Branch set to http://github.com/stereotype441/puppet/tree/ticket/next/4685

This bug happened because ASTArray#evaluate() was responsible for checking whether the user had tried to declare a class, define, or node in a prohibited location. So if the erroneous code wasn’t evaluated, no error would be generated.

I’ve moved the checking into the parser, so that errors are always evaluated.

Updated by Jesse Wolfe over 1 year ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Assignee changed from Paul Berry to Jesse Wolfe
  • Branch changed from http://github.com/stereotype441/puppet/tree/ticket/next/4685 to http://github.com/reductivelabs/puppet/tree/next

available in next as 1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf

Updated by Nick Lewis about 1 year ago

  • Status changed from Merged - Pending Release to Closed

Updated by James Turnbull 7 months ago

  • Target version changed from 2.7.x to 2.7.0

Also available in: Atom PDF