How can I access the params.pp variables in Serverspec tests?

asked 2016-08-03 12:29:03 -0600

We want to include suites of Serverspec tests into our modules, but I can't figure out how to use the variables set in params.pp in the spec tests. I can see how to get facter data, and think I can figure out how to access data via a hiera lookup, but have been struggling to figure out how to access the params in params.pp. We have a number of modules that use the params.pp model, and it's not realistic to rewrite them all for this requirement.

Any suggestions?

edit retag flag offensive close merge delete


Just to clarify, you actually mean serverspec and not rspec-puppet?

kaizenCoder gravatar imagekaizenCoder ( 2016-08-04 21:34:33 -0600 )edit

@kaizenCoder, yes, Serverspec. We want to use Serverspec to automate server build validation. We have several hardware and OS platforms, so many of our Puppet modules have params.pp files that set various variables depending on OS and platform. I'd like to reuse the params.pp data.

greggha gravatar imagegreggha ( 2016-08-09 10:52:12 -0600 )edit

i'm not sure if this can be done out of the box. Are these site specific data? If so, you can put them into hiera yaml file. I've gone down this path of reading the yaml file values serverspec.

kaizenCoder gravatar imagekaizenCoder ( 2016-08-10 05:23:27 -0600 )edit