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

hiera_include broken

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • PUP 4.0.0
    • None
    • None
    • Vagrant Atlas box puppetlabs/centos-7.0-64-nocm

    • 1
    • Language 2015-03-18

    Description

      Using hiera_include() with puppet-agent as of version 0.3.2.29.g49f7b1b-1.el7 cannot be used due to two problems:

      • a missing requirement on hiera/puppet_function
      • a 4x function loaded from puppet cannot call another functions because there is no 'private loader'

      The second problem is reproduced by this manifest:

      class foo {
        notice yay
      }
      hiera_include(classes, [foo])
      

      Which reports the error:

      Error: Evaluation Error: Error while evaluating a Function Call, Function hiera_include(): cannot call function 'include' - no loader specified at /Users/henrik/git/puppet/foo.pp:4:1
      

      ORIGINAL REPORT


      The following error is produced for the missing requirement.

      [root@puppet4 manifests]# /opt/puppetlabs/puppet/bin/puppet apply default.pp -t
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Error: Evaluation Error: Error while evaluating a Function Call, uninitialized constant Hiera::PuppetFunction at /etc/puppetlabs/puppet/manifests/default.pp:17:1 on node puppet4.vm.super-visions.com
      Error: Evaluation Error: Error while evaluating a Function Call, uninitialized constant Hiera::PuppetFunction at /etc/puppetlabs/puppet/manifests/default.pp:17:1 on node puppet4.vm.super-visions.com
      

      default.pp

      hiera_include('classes', [] )
      

      hiera.yaml

      ---
      :backends:
        - yaml
      :hierarchy:
        - defaults
        - "%{clientcert}"
        - "%{environment}"
        - global
       
      :yaml:
      # datadir is empty here, so hiera uses its defaults:
      # - /etc/puppetlabs/code/hieradata on *nix
      # - %CommonAppData%\PuppetLabs\hiera\var on Windows
      # When specifying a datadir, make sure the directory exists.
        :datadir: /etc/puppetlabs/hieradata
      

      /etc/puppetlabs/hieradata is empty, same result with a global.yaml file tested and working on puppet-agent-0.3.2.22.g8642ba7-1.el7 (and before).
      puppet.conf is empty

      More testing shows the following:
      When adding any/all of the following lines 'before' the hiera_include() in the .pp file the error changes.

      $a = hiera('a','a')
      $b = hiera_hash('b',{})
      $c = hiera_array('c',[])
      

      With the patch from https://github.com/puppetlabs/puppet/pull/3655 applied the error changes to:

      [root@puppet4 ~]# puppet apply /etc/puppetlabs/puppet/manifests/default.pp -t
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Error: Evaluation Error: Error while evaluating a Function Call, Function hiera_include(): cannot call function 'include' - no loader specified at /etc/puppetlabs/puppet/manifests/default.pp:23:1 on node puppet4.vm.super-visions.com
      Error: Evaluation Error: Error while evaluating a Function Call, Function hiera_include(): cannot call function 'include' - no loader specified at /etc/puppetlabs/puppet/manifests/default.pp:23:1 on node puppet4.vm.super-visions.com
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zipkid Stefan Goethals
              Eric Thompson Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support