Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

if statement error in rspec-puppet

$
0
0
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"

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>