Ask Your Question
0

invalid parameter error in rspec-puppet

asked 2016-02-09 04:51:35 -0500

Chutki gravatar image

Hi,

I want to test all the if conditions of manifests

if $::operatingsystem == 'RedHat' {
  package { 'packagename' :
      ensure  => latest,

    }
}

 if $::operatingsystemmajrelease >= '7' {
      include 'dependent class'
    }

Below is the rspec-puppet for the manifest

let(:facts) {{ :operatingsystem => 'RedHat', :operatingsystemmajrelease => '6'}}

  context 'operatingsystem is Redhat' do
    let(:params) { {:operatingsystemmajrelease => 6} }

    it { should compile.with_all_deps }

    it { should contain_package(packagename).with(
        'ensure'  => 'latest'
    )}

  context 'operatingsystemmajrelease is 7' do
  let(:facts) {{ :operatingsystemmajrelease => '7'}}
   let(:params) { {:operatingsystemmajrelease => 7} }
    it { should contain_class('dependent class') }

I am getting "Invalid parameter operatingsystemmajrelease on Class[class_name] at line 3 on node"

how can I test the "if condition" if the operatingsystemmajrelease is 6 or operatingsystemmajrelease is 7

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-09 09:19:11 -0500

My recommendation to you is to look at the documentation and firstly try to understand what each line is doing. In particular, what do you think the line about let(:params) is doing? Sorry to answer with a question, but you really need to do this.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-02-09 04:51:35 -0500

Seen: 114 times

Last updated: Feb 09 '16