Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
PUP 6.26.0, PUP 7.14.0
-
None
-
-
Phoenix
-
2
-
Phoenix 2022-03-02, Phoenix 2022-03-16
-
Needs Assessment
-
49053
-
1
-
Bug Fix
-
-
Needs Assessment
Description
A regression introduced in PUP-7479 causes "puppet lookup --environment <env> <key>" to no longer set node parameters as topscope variables. If hiera.yaml is configured to interpolate based on topscope variables, such as "nodes/%{fqdn}.yaml", then the variable will be interpolated as an empty string.
Given a basic setup:
# tree /etc/puppetlabs/code/environments/
|
/etc/puppetlabs/code/environments/
|
├── production
|
└── test
|
├── data
|
│  ├── common.yaml
|
│  └── iron-judgement.yaml
|
└── hiera.yaml
|
|
3 directories, 3 files
|
# cat /etc/puppetlabs/code/environments/test/hiera.yaml
|
---
|
version: 5
|
hierarchy:
|
- name: "node"
|
paths:
|
- "%{hostname}.yaml"
|
- name: "common"
|
paths:
|
- "common.yaml"
|
# cat /etc/puppetlabs/code/environments/test/data/common.yaml
|
---
|
foo: defined in common
|
# cat /etc/puppetlabs/code/environments/test/data/iron-judgement.yaml
|
--- {}
|
Then a warning is generated trying to resolve the `hostname` variable:
# bundle exec puppet lookup -E test foo --explain
|
Warning: Undefined variable 'hostname';
|
(file & line not available)
|
Searching for "lookup_options"
|
Global Data Provider (hiera configuration version 5)
|
No such key: "lookup_options"
|
Environment Data Provider (hiera configuration version 5)
|
Using configuration "/etc/puppetlabs/code/environments/test/hiera.yaml"
|
Merge strategy hash
|
Hierarchy entry "node"
|
Path "/etc/puppetlabs/code/environments/test/data/.yaml"
|
Original path: "%{hostname}.yaml"
|
Path not found
|
Hierarchy entry "common"
|
Path "/etc/puppetlabs/code/environments/test/data/common.yaml"
|
Original path: "common.yaml"
|
No such key: "lookup_options"
|
Note the path "/etc/puppetlabs/code/environments/test/data/.yaml"
The issue does not occur when an environment is omitted from the command line or when hiera interpolation uses facts such as "nodes/%{facts.hostname}.yaml".