Details
-
Task
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
FACT 4.2.8
-
-
Phoenix
-
2
-
Phoenix 2022-08-17, Phoenix 2022-08-31
-
48920
-
1
-
Bug Fix
-
This change enabled YAML anchors in Facter 4, a feature that was available previously in Facter 3. Additionally, testing was added to ensure Facter continues to behave as expected when handling YAML anchors.
-
Needs Assessment
Description
It appears that yaml anchors have stopped working in facter 4. In facter 3, this external yaml fact is processed correctly:
// "/opt/puppetlabs/facter/facts.d/test.yaml" 13L, 118C 9,7 All
|
---
|
one:
|
ipam:
|
a:
|
&a1
|
- foo
|
cname:
|
&a2
|
- bar
|
two:
|
IPAM:
|
A: *a1
|
CNAME: *a2
|
When running puppet facts --debug:
// ESC[0;36mDebug: Facter: resolving facts from YAML file "/opt/puppetlabs/facter/facts.d/test.yaml".ESC[0m
|
ESC[0;36mDebug: Facter: fact "one" has resolved to { |
ipam => {
|
a => [
|
"foo" |
],
|
cname => [
|
"bar" |
]
|
}
|
}.ESC[0m
|
ESC[0;36mDebug: Facter: fact "two" has resolved to { |
IPAM => {
|
A => [
|
"foo" |
],
|
CNAME => [
|
"bar" |
]
|
}
|
}.ESC[0m
|
In facter 4, this fails:
// c:Error: Facter: Failed to handle /opt/puppetlabs/facter/facts.d/test.yaml as LegacyFacter::Util::Parser::YamlParser facts: Unknown alias: a1
|
The expectation is that yaml anchors should function the same as they did in prior versions. Support has recommended their use on multiple prior occasions.