Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-11595

puppet lookup fails to resolve topscope variables from node classifier

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • PUP 6.27.0
    • None
    • None
    • Phoenix
    • Customer Feedback
    • 49053
    • 1
    • Needs Assessment

    Description

      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).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bastelfreak Tim Meusel
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support