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

Disabling automatic class parameter lookup in Hiera 5 also disables the global hierarchy layer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: PUP 4.9.0, PUP 4.10.4
    • Fix Version/s: PUP 4.10.6, PUP 5.1.0
    • Component/s: Hiera & Lookup
    • Labels:
      None
    • Template:
    • Sub-team:
    • Team:
      Platform Core
    • Story Points:
      1
    • Sprint:
      Platform Core 2017-08-08
    • Method Found:
      Customer Feedback
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      A regression introduced with Hiera 5 caused the setting of {{data_binding_terminus=none}} to turn off the {{hiera_xxx}} functions in addition to the expected disablement of APL (Automatic Parameter Lookup) from the global layer. This is now changed so that the {{hiera_xxx}} calls will continue to work. The {{lookup}} function will continue to return the same result as APL (if the terminus is disabled, then global hiera is also turned off for lookup, while APL and lookup from environment and module layers is still enabled). In the longer run, the {{data_binding_terminus}} setting will be deprecated and removed along with the hiera 3 support. With the speedups and new features in hiera 5, there should be no reason to turn off the {{data_binding_terminus}}.
      Show
      A regression introduced with Hiera 5 caused the setting of {{data_binding_terminus=none}} to turn off the {{hiera_xxx}} functions in addition to the expected disablement of APL (Automatic Parameter Lookup) from the global layer. This is now changed so that the {{hiera_xxx}} calls will continue to work. The {{lookup}} function will continue to return the same result as APL (if the terminus is disabled, then global hiera is also turned off for lookup, while APL and lookup from environment and module layers is still enabled). In the longer run, the {{data_binding_terminus}} setting will be deprecated and removed along with the hiera 3 support. With the speedups and new features in hiera 5, there should be no reason to turn off the {{data_binding_terminus}}.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      Covered by spec tests

      Description

      Disabling automatic class parameter lookup in Hiera 5 also disables the global hierarchy layer

      Prior to Puppet 4.9.0 and the integration of Hiera 5, setting the data_binding_terminus to none would disable automatic lookup of class parameters while keeping explicit lookups via the hiera() functions enabled. Starting with Puppet 4.9.0, setting data_binding_terminus to none disables hiera() entirely.

      Reproduction Case

      • Install PE 2016.4.6.
      • Replace ` /etc/puppetlabs/code/environments/production/manifests/site.pp` with the following content:

      class testclass (
        $param1 = 'default',
        $param2 = 'default',
      ) {
       
        notify {"param1: ${param1}": }
        notify {"param2: ${param2}": }
       
      }
       
      node default {
        class {'testclass':
          param1 => hiera('param1'),
        }
      }
      

      • Add the following data to /etc/puppetlabs/code/environments/production/hieradata/common.yaml:

      param1: hiera_override
      testclass::param2: hiera_override
      

      • Disable the data_binding_terminus:

      puppet config set --section master data_binding_terminus none
      

      • Re-start pe-puppetserver
      • Run puppet agent -t

      Outcome

      The puppet run fails with a lookup() error:

      [root@pe-201646-master production]# puppet agent -t
      Info: Using configured environment 'production'
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'param1' on node pe-201646-master.puppetdebug.vlan
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      Expected Outcome

      The run succeeds, and only param1 of testclass is overridden via Hiera data:

      [root@pe-201643-master manifests]# puppet agent -t
      Info: Using configured environment 'production'
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-201643-master.puppetdebug.vlan
      Info: Applying configuration version '1500938483'
      Notice: param1: hiera_override
      Notice: /Stage[main]/Testclass/Notify[param1: hiera_override]/message: defined 'message' as 'param1: hiera_override'
      Notice: param2: default
      Notice: /Stage[main]/Testclass/Notify[param2: default]/message: defined 'message' as 'param2: default'
      Notice: Applied catalog in 11.76 seconds
      

      This was the behavior prior to Puppet 4.9.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                chuck Charlie Sharpsteen
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support