Feature #962

Addition of value testing and logical/comparison operators

Added by James Turnbull over 4 years ago. Updated over 3 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:Luke Kanies % Done:

0%

Category:language
Target version:-
Affected Puppet version:0.24.4 Branch:
Keywords:
Votes: 0

Description

It would be very useful to be able to test values and use logical operators in Puppet – particularly as an enhancement of conditionals. For example:

if $variable = "value" { action }
if $variable != "value" { action }
if $variable = "value" AND $variable2 = "value2" { action }
if $variable = "value" OR $variable2 = "value2" { action }

etc…

There are obviously other potential uses but the extension of the if/else capability would be very useful.


Related issues

related to Puppet - Bug #1386: statement negation (if ! ) Duplicate 07/01/2008
related to Puppet - Feature #1585: Allow complex 'if' test boolean expressions. Closed 09/20/2008

History

Updated by Luke Kanies over 4 years ago

I’d accept this patch (although not with the capital AND and OR, and I’d expect ‘==’ as the comparison operator, rather than ‘=’).

Updated by James Turnbull over 4 years ago

Yes – that was my crude operator examples – I’d use the default Ruby operators I suspect, i.e. ==.

Updated by Redmine Admin almost 4 years ago

  • Status changed from 1 to Accepted

Updated by James Turnbull almost 4 years ago

  • Affected Puppet version set to 0.24.4

Closed #1386 as duplicate.

Updated by James Turnbull almost 4 years ago

Also the if/else/unless construct might be useful.

Updated by James Turnbull over 3 years ago

  • Status changed from Accepted to Closed

Fixed by #1585.

Also available in: Atom PDF