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

PUP 4.9.3 interpolation in hiera.yaml datadir stopped working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: PUP 4.9.3
    • Fix Version/s: PUP 4.9.4
    • Component/s: None
    • Environment:
    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDE 2017-03-08
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      A regression in the interpretation of a hiera.yaml (all versions) caused interpolation in the datadir option to stop working. This is now fixed.
    • QA Risk Assessment:
      Automate

      Description

      After the latest upgrade Hiera support does NOT work at all.

      Configured as follows:
      /etc/puppetlabs/puppet/hiera.yaml (v3):

      ---
      :backends:
        - yaml
      :hierarchy:
        - "nodes/%{::trusted.certname}"
        - "roles/%{::role}"
        - "virtual_%{::is_virtual}"
        - "os_%{::operatingsystem}"
        - "env_%{environment}"
        - common
       
      :logger: console
      # options are native, deep, deeper
      :merge_behavior: deeper
      :deep_merge_options:
        :merge_hash_arrays: true
        :unpack_arrays: true
      #  :preserve_unmergeables: true
      #  :knockout_prefix: '--'
       
      :yaml:
      # datadir is empty here, so hiera uses its defaults:
      # - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix
      # - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows
      # When specifying a datadir, make sure the directory exists.
        :datadir: /etc/puppetlabs/code/environments/%{environment}/hieradata
      

      /etc/puppetlabs/code/hiera.yaml (v5):

      ---
      version: 5
       
      defaults:
        #  datadir: /etc/puppetlabs/code/environments/%{environment}/hieradata
        datadir: data
        data_hash: yaml_data
       
      hierarchy:
        - name: "Nodes"
          path: "nodes/%{::trusted.certname}.yaml"
        - name: "Roles"
          path: "roles/%{::role}.yaml"
        - name: "Vurtual"
          path: "virtual_%{::is_virtual}.yaml"
        - name: "OS"
          path: "os_%{::operatingsystem}.yaml"
        - name: "Environment"
          path: "env_%{environment}.yaml"
        - name: "Common Defaults"
          path: "common.yaml"
      

      /etc/puppetlabs/code/environments/corporate/manifests/site.pp:

      Before the upgrade it had only one line and everything was fine:

      hiera_include('classes')
      

      As per documentation, tried the following after the upgrade ("either or" and both blocks):

      include lookup('classes', { 'merge' => 'deep' })
      

      lookup('classes', Array[String], 'deep').include
      lookup({ 'name'  => 'classes',
               'merge' => {
                  'strategy'          => 'deep',
                  'merge_hash_arrays' => true,
              },
      })
      

      When running agent getting:

      > sudo puppet agent -t
      Info: Using configured environment 'corporate'
      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 'classes' on node <host>
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      and more in /var/log/puppetlabs/puppetserver/puppetserver.log:

      2017-03-01 11:01:42,365 ERROR [qtp1371536656-79] [puppetserver] Puppet Function lookup() did not find a value for the name 'classes'
      2017-03-01 11:01:42,365 ERROR [qtp1371536656-79] [puppetserver] Puppet Function lookup() did not find a value for the name 'classes' on node <host>
      2017-03-01 11:01:42,365 ERROR [qtp1371536656-79] [puppetserver] Puppet Server Error: Function lookup() did not find a value for the name 'classes' on node <host>
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup.rb:86:in `fail_lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup.rb:57:in `lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/../../../puppet/functions/lookup.rb:209:in `do_lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/../../../puppet/functions/lookup.rb:205:in `lookup_5'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/dispatch.rb:47:in `invoke'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/dispatcher.rb:36:in `dispatch'
      org/jruby/RubyKernel.java:1242:in `catch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/dispatcher.rb:35:in `dispatch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/function.rb:46:in `call'
      org/jruby/RubyKernel.java:1242:in `catch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/function.rb:45:in `call'
      /etc/puppetlabs/code/environments/corporate/manifests/site.pp:1:in `call_function'
      

      Please advise.

        Attachments

        1. meta3_manifest
          2 kB
        2. meta5_manifest
          2 kB
        3. puppetserver-20170301-debug.log
          216 kB

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            alexpr Alex P
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support