1

I have below manifests in puppet:

class env {
    $line = hiera('LINE')

    file { '/opt/dt/LINE' 
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => "${line}\n",
    }
}

I want to write serverspec for this, but do we have an option in serverspec to pass Hiera value like how we pass Hiera value in rspec-puppet test case.

I tried browsing for an serverspec Hiera example but no luck :(

Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87
Puppeteer
  • 63
  • 1
  • 7

1 Answers1

0

I have created '.yml' file under root of the module and added below lines in '_spec.rb' file and it worked :)

require 'yaml' 

tmp = YAML.load_file 'pack.yml'
 tmp.each do|a|
    describe package(a) do
      it { should be_installed }
Puppeteer
  • 63
  • 1
  • 7