Ask Your Question
0

issue with assigning parameter variable in rspec-puppet

asked 2015-07-31 08:02:21 -0600

Chutki gravatar image

updated 2015-07-31 08:03:14 -0600

Hi,

I have below manifests to install packages

$pckg = [
    'package1',
    'package2'
  ]

  package { $pckg : ensure => latest }

but when I apply the in rspec-puppet getting error spec/classes/pack_spec.rb

let(:params) {{ :pckg => 'package1' }}

  it { should contain_package(pckg).with_ensure('latest')}

getting below error

FF

Failures:

  1) pack should contain Package[package1] with ensure => "latest"
     Failure/Error: it { should contain_package(pckg).with_ensure('latest')}
     Puppet::Error:
       Invalid parameter pckg on Class[pack] at line 3 on node 
     # ./spec/classes/pack_spec.rb:9

why I am unable to pass parameter variable "pckg"

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-31 17:11:51 -0600

GregLarkin gravatar image

The params hash is only for defining values of class parameters, not variable values inside of a class.

edit flag offensive delete link more

Comments

Thanks or the update. but how we can assign varialbe in rspec-puppet

Chutki gravatar imageChutki ( 2015-08-03 11:26:49 -0600 )edit

I don't see a way to do it in the rspec language.

GregLarkin gravatar imageGregLarkin ( 2015-08-03 15:01:16 -0600 )edit

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: 2015-07-31 08:02:21 -0600

Seen: 398 times

Last updated: Jul 31 '15