Hi,
I have boolean value in hiera variable.
$bol = hiera('bolvalue', false)
if str2bool($bol) {
package { ['pckg1','pckg2']: ensure => latest }
else
package { ['pckg1','pckg2']: ensure => absent }
hiera file
common.yaml
bolvalue: 'true'
I tried if statment in rspec-puppet
[pckg1','pckg2'].each do|pckg|
['true','false'].each do|bool|
if bool == 'true'
it { should contain_package(pckg).with_ensure('latest') }
else
it { should contain_package(pckg).with_ensure('absent') }
end
end
end
but I am getting below error
Failure/Error: it { should contain_package(pckg).with_ensure('absent') }
expected that the catalogue would contain Package[pckg1] with ensure set to "absent" but it is set to "latest"
↧