Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add server facts when looking up values
During normal catalog compilation, server facts are added by the `compiler` terminus prior to calling `Puppet::Parser::Compiler.compile`[1]. However, the lookup application directly calls `Compiler.compile`, bypassing the `compiler` terminus[2]. Therefore, server facts weren't being added when running the lookup command. Ideally, catalog compilation and the lookup command would compile the catalog in the same way, but changing that is risky. For that to work, we would need to pass the already resolved node and facts to the `compiler` terminus and the terminus would need to add server facts to the node. However, the terminus doesn't add server facts if the node is passed in. It only does that if it resolves the node using the indirector[3]. Rather than mess with the terminus and break compilation, just load server facts in the same way that the `compiler` terminus does. [1] https://github.com/puppetlabs/puppet/blob/8.7.0/lib/puppet/indirector/catalog/compiler.rb#L56 [2] https://github.com/puppetlabs/puppet/blob/8.7.0/lib/puppet/application/lookup.rb#L407 [3] https://github.com/puppetlabs/puppet/blob/8.7.0/lib/puppet/indirector/catalog/compiler.rb#L390
- Loading branch information