puppetlabs/puppet — pull request #1934 by donnieblaw (2013-09-24 19:53:48+00:00)
Title: (22617) In Augeas onlyif, compare number strings numerically

Without this patch applied, onlyif comparitors <, >, <=, and >= always
do string comparisions, even when the strings are numbers. This
makes it impossible to enforce relative policy, such as:

onlyif => 'get PASS_MAX_DAYS > 90',

in login.defs, for example. If PASS_MAX_DAYS had the value 120, the
onlyif would evaluate false (not need-to-run). See ticket for more details.

Without this patch, onlyif uses string comparison, such that 120 < 90.

This patch converts strings to integers and uses numeric comparison
when both operands of the relative comparitor are valid numbers.

This patch also fixes another bug that isn't reported in a ticket, namely
that the parser erroneously converts ">=" to ">" and "<=" to "<".