Feature #1585
Allow complex 'if' test boolean expressions.
| Status: | Closed | Start date: | 09/20/2008 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | newfeature | |||
| Target version: | 0.24.6 | |||
| Affected Puppet version: | 0.24.5 | Branch: | ||
| Keywords: | parser expression if boolean | |||
| Votes: | 0 |
Description
Hi,
I just finished a parser modification that allows arbitrary complex ‘if’ test expressions. The currently supported operators are: * Comparison == != < <= > >= * Boolean operators: not (!) or ** and
Example usage:
if ($ram < 2048) and (($nb_cpu >= 2) or ($distribution == ‘lenny’) and ! $var) { … }
Please review and merge if it meets the necessary requirements.
The patch consists in 4 commits based on 0.24.x which are hosted in the feature/ifexpr branch in the masterzen/puppet github repository, or directly from: http://github.com/masterzen/puppet/commits/feature/ifexpr/
Related issues
History
Updated by Brice Figureau over 3 years ago
Please don’t merge yet, the current patch is not completely correct (missing fixes from Luke) and it is evolving as a more generic expression parser (including arithmetic expressions). I’ll update the ticket after the patch is ready, reviewed and accepted.
Updated by James Turnbull over 3 years ago
- Status changed from Unreviewed to Accepted
- Assignee set to Brice Figureau
Updated by Brice Figureau over 3 years ago
- Status changed from Accepted to Needs Decision
- Assignee changed from Brice Figureau to Luke Kanies
Hi,
I posted to the devel list 5 patches, which are also available here: http://github.com/masterzen/puppet/tree/feature%2Fexpression This is against 0.24.x
Those patches implements a more complete expression parser than what I originally did first in this ticket. The patch allows now to have arithmetic expressions combined with comparison operators and boolean operators. Expressions can now be used in if clause or in assignement right values.
Luke, the ball is in your camp, please review and accept if that meets your selection criterions.
Updated by James Turnbull over 3 years ago
- Status changed from Needs Decision to Closed
Pushed in commit:4cf9710bd27fdb5f0720f4d8478ef940e7c4ba59 and commit:cfa230a2d7b0c5e57cc0379785bd2025520f1c35 and commit:850e0baf0fbe321f14d4b9d913ce7dea39c9aa27 and commit:9cdecfecce84b9e0a88b5ea86b3136a1025ac9d9 and commit:8372dc4ca80d95e62c407708a48e51ac09ad2f55 – all in branch 0.24.x
See updates to:
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial
For full details.