Jira (PUP-11595) puppet lookup fails to resolve topscope variables from node classifier

38 views
Skip to first unread message

Tim Meusel (Jira)

unread,
Jul 25, 2022, 9:16:01 AM7/25/22
to puppe...@googlegroups.com
Tim Meusel created an issue
 
Puppet / Bug PUP-11595
puppet lookup fails to resolve topscope variables from node classifier
Issue Type: Bug Bug
Affects Versions: PUP 6.27.0
Assignee: Unassigned
Created: 2022/07/25 6:15 AM
Priority: Normal Normal
Reporter: Tim Meusel

Puppet Version: 6.27.0 / 7.16.0
Puppet Server Version: 2019.8.11 / 2021.6.0
OS Name/Version: RHEL 8

We've a hiera.yaml that uses topscope facts within paths, like data/%{::tier}.yaml. With PE 2019.8.9, this worked fine. In https://tickets.puppetlabs.com/browse/PUP-7479 puppet lookup was broke due to a regression (and released in PE 2019.8.10). This was fixed in parts in https://tickets.puppetlabs.com/browse/PUP-11437 (and released in PE 2019.8.11).
I also placed a comment in https://tickets.puppetlabs.com/browse/PUP-11437 and a slack thread at https://puppetcommunity.slack.com/archives/C19V5U41Z/p1658312927398119

Desired Behavior:
puppet lookup --node $(hostname -f) --compile --environment $hiera_key should work as expected.

Actual Behavior:
puppet lookup fails to resolve the variable. When hiera.yaml uses data/%{::tier}.yaml, puppet lookup will look into data/.yaml.

I raised a PE support ticket for this. Jarret Lavallee suggested this patch (on the 6.27.0 git tag):

diff --git a/lib/puppet/application/lookup.rb b/lib/puppet/application/lookup.rb
index b9e6f22c87..cc6affcb9e 100644
--- a/lib/puppet/application/lookup.rb
+++ b/lib/puppet/application/lookup.rb
@@ -376,7 +376,7 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
       facts = retrieve_node_facts(node, given_facts)
       ni = Puppet::Node.indirection
       tc = ni.terminus_class
-      if options[:compile] && !Puppet.settings.set_by_cli?('environment')
+      if options[:compile]
         if tc == :plain
           node = ni.find(node, facts: facts)
         else

I restarted all PE services and did a few agent runs. I can confirm that this fixes the problem, but I don't know if this causes any side effects (that's why I didn't provide this change as a PR).

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Alvin Rodis (Jira)

unread,
Jul 25, 2022, 9:36:02 AM7/25/22
to puppe...@googlegroups.com
Alvin Rodis updated an issue
Change By: Alvin Rodis
Zendesk Ticket Count: 1
Zendesk Ticket IDs: 49053

Alvin Rodis (Jira)

unread,
Jul 25, 2022, 9:36:02 AM7/25/22
to puppe...@googlegroups.com

Jarret Lavallee (Jira)

unread,
Jul 25, 2022, 10:17:03 AM7/25/22
to puppe...@googlegroups.com
Jarret Lavallee commented on Bug PUP-11595
 
Re: puppet lookup fails to resolve topscope variables from node classifier

I suspect that the environment will need to be passed into the find when Puppet.settings.set_by_cli?('environment'). The initial thought was that either trusted facts were missing from the nc query or that it was being forced to :plain, but I don't know this code well enough to say what the correct fix should be.

Jarret Lavallee (Jira)

unread,
Jul 25, 2022, 10:18:02 AM7/25/22
to puppe...@googlegroups.com

Jarret Lavallee (Jira)

unread,
Jul 25, 2022, 10:18:03 AM7/25/22
to puppe...@googlegroups.com
Jarret Lavallee updated an issue
Change By: Jarret Lavallee
Method Found: Needs Assessment Customer Feedback

Tim Meusel (Jira)

unread,
Aug 25, 2022, 5:43:02 AM8/25/22
to puppe...@googlegroups.com
Tim Meusel commented on Bug PUP-11595
 
Re: puppet lookup fails to resolve topscope variables from node classifier

Hi people,
is this something that can be fixed in the near future? this is a regression and the customer relies on this feature.

Josh Cooper (Jira)

unread,
Sep 2, 2022, 11:46:01 AM9/2/22
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages