Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your hiera's hierarchy is that hiera will always search files in this order: 1. common .yaml 2. linux01.yaml 3. linux02.yaml 4. linux03.yaml beacause value is found in linux01.yaml (I think you use $hieravariable = hiera('hieravariable')) two other files are not checked anymore.

Try something like it: Hiera hierarchy:

- %{operatingsystem}
- common

common.yaml should be checked as last one.

Three files Debian.yaml, Redhat.yaml, Ubuntu.yaml (I'm not sure if its correct value for operating systems but for tests is good enough) and use context:

    context 'for Redhat OS' do
      let(:facts) { {:operatingsystem => 'Redhat'} }

      it do
       should contain_exec('Create something lx01')
      end
     end

Code wasn't tested so it can be bugy.

Your hiera's hierarchy is that hiera will always search files in this order: 1. order:

  1. common .yaml 2. linux01.yaml 3. linux02.yaml 4. linux03.yaml .yaml
  2. linux01.yaml
  3. linux02.yaml
  4. linux03.yaml

beacause value is found in linux01.yaml (I think you use $hieravariable = hiera('hieravariable')) two other files are not checked anymore.

Try something like it: Hiera hierarchy:

- %{operatingsystem}
- common

common.yaml should be checked as last one.

Three files Debian.yaml, Redhat.yaml, Ubuntu.yaml (I'm not sure if its correct value for operating systems but for tests is good enough) and use context:

    context 'for Redhat OS' do
      let(:facts) { {:operatingsystem => 'Redhat'} }

      it do
       should contain_exec('Create something lx01')
      end
     end

Code wasn't tested so it can be bugy.

Your hiera's hierarchy is that hiera will always search files in this order:

  1. common .yaml
  2. linux01.yaml
  3. linux02.yaml
  4. linux03.yaml

beacause value is found in linux01.yaml (I think you use used $hieravariable = hiera('hieravariable')) two other files are not checked anymore.

Try something like it: Hiera Hiera's hierarchy:

- %{operatingsystem}
- common

common.yaml should be checked as last one.

Three files Debian.yaml, Redhat.yaml, Ubuntu.yaml (I'm not sure if its correct value for operating systems but for tests is good enough) and use context:

    context 'for Redhat OS' do
      let(:facts) { {:operatingsystem => 'Redhat'} }

      it do
       should contain_exec('Create something lx01')
      end
     end

Code wasn't tested so it can be bugy.