diff options
author | Emerson Prado <emerson.prado@dataprev.gov.br> | 2017-02-03 17:00:03 -0200 |
---|---|---|
committer | Emerson Prado <emerson.prado@dataprev.gov.br> | 2017-02-03 17:00:03 -0200 |
commit | 76d0ec471d074a07cc2cece3963dd9c8c2d18aeb (patch) | |
tree | 1809bb232a618dc7ba0feeaf63d18309d74bd9a1 | |
parent | db8c1fbb2394d93fe3156b17c840455f1b3e2c76 (diff) |
Include routine to converge ensure values 'present' and 'installed'
If user declares ensure_package concurrently with ensure values
'present' and 'installed', function fails as if values were different
Change causes function to interpret ensure => 'installed' as 'present',
effectively elliminating the error
Also works if user doesn't specify ensure value, since 'present'
is the default
-rw-r--r-- | lib/puppet/parser/functions/ensure_packages.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/ensure_packages.rb b/lib/puppet/parser/functions/ensure_packages.rb index 439af1e..93dd4fb 100644 --- a/lib/puppet/parser/functions/ensure_packages.rb +++ b/lib/puppet/parser/functions/ensure_packages.rb @@ -20,6 +20,9 @@ third argument to the ensure_resource() function. if arguments[0].is_a?(Hash) if arguments[1] defaults = { 'ensure' => 'present' }.merge(arguments[1]) + if defaults['ensure'] == 'installed' + defaults['ensure'] = 'present' + end else defaults = { 'ensure' => 'present' } end @@ -31,6 +34,9 @@ third argument to the ensure_resource() function. if arguments[1] defaults = { 'ensure' => 'present' }.merge(arguments[1]) + if defaults['ensure'] == 'installed' + defaults['ensure'] = 'present' + end else defaults = { 'ensure' => 'present' } end |