In an scenario with 2 classes: pk1::claseA and pk::1claseB
with claseA like:
pk1::claseA {
$somevariable = hiera('myvariable')
notify{$variable:}
}
and claseB like:
pk1::claseB inherits pk1::claseA {}
with the tree dir for the module pk1:
pk1
pk1/manifests
pk1/manifests/claseA.pp
pk1/manifests/claseB.pp
and a node like:
node 'pilot' {
include claseB
}
and a hiera.yaml like:
:backends:
- yaml
:hierarchy:
- "domains/%{calling_class_path}"
- common
:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix
# - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows
# When specifying a datadir, make sure the directory exists.
:datadir:
and a file /etc/puppetlabs/code/environments/production/hieradata/domains/pk1/claseA.yaml with the content:
myvariable = 'A'
and a file /etc/puppetlabs/code/environments/production/hieradata/domains/pk1/claseB.yaml with the content:
myvariable = 'B'
$somevariable should be resolved to 'A' or to 'B' ?
In the tests I've ran the answer is A but I don't really know if I'm doing something wrong or it is the expected behaviour.
Thanks in advance!
↧