Feature #962
Addition of value testing and logical/comparison operators
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % 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
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.