with a hierarchy variable assigned at node level
node 'test' {
$role = 'test'
}
and variable used in hiera 5 'environment' level
---
version: 5
defaults:
datadir: hieradata
data_hash: yaml_data
hierarchy:
- name: "Data"
paths:
- "%{role}.yaml"
- "common.yaml"
and data in hieradata/test.yaml
key: value
puppet lookup fails with or without --compile flag with warning
Warning: Undefined variable 'role';
(file & line not available)
In order for the lookup CLI to get that right, it would need to:
To fix this we would need to add a flag to the CLI --class_scope=<name-of-class>, and that use of that flag implies --compile
I wonder if setting a variable in the PE NC has the same behavior?
I tested, variable defined in PE works as expected
Thanks for testing that Vadym Chepkov
ENC works because that does not take place inside of node scope.
We're probably not going to get to this any time soon. If it's important or you have specific use cases for it, please reopen with that info.