Uploaded image for project: 'Hiera'
  1. Hiera
  2. HI-539

Hierarchies are being ignored

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Needs Information
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: HI 3.2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Ubuntu 16.04
      Puppetserver 2.6.0
      Puppet-agent 1.6.2

    • Template:

      Description

      Please consider the snippets below.

      cat /etc/puppetlabs/code/environments/production/hiera.yaml

      ---
      version: 4
      datadir: hieradata
       
      hierarchy:
        # Just some of the varieties I've tested:
        - name: "Virtual"
          backend: yaml
          paths:
            - "virtual/%{facts.virtual}"
            - "%{facts.virtual}"
       
        - name: "Virtual, 2"
          backend: yaml
          path: "virtual/%{facts.virtual}"
       
        - name: 'Virtual, 3'
          backend: yaml
          path: "virtual/%{::virtual}"
       
        - name: 'Virtual, 4'
          backend: yaml
          path: "virtual/%{::facts.virtual}"
       
        - name: "virtual/%{facts.virtual}"
          backend: yaml
       
        - name: "virtual/%{::facts.virtual}"
          backend: yaml
       
        - name: "virtual/%{::virtual}"
          backend: yaml
       
        - name: "%{facts.virtual}"
          backend: yaml
       
        - name: "%{::virtual}"
          backend: yaml
       
        - name: 'Nodes'
          backend: yaml
          path: "nodes/%{::trusted.certname}"
       
        - name: 'common'
          backend: yaml
      

      cat /etc/puppetlabs/code/environments/production/hieradata/virtual/virtualbox.yaml

      ---
      virt: 'virtual/virtualbox'
      

      cat /etc/puppetlabs/code/environments/production/hieradata/virtualbox.yaml

      ---
      virt: 'virtualbox'
      

      cat /etc/puppetlabs/code/environments/production/hieradata/nodes/node01.yaml

      ---
      virt: 'nodes/node01'
      

      cat /etc/puppetlabs/code/environments/production/hieradata/common.yaml

      ---
      virt: 'common'
      

      cat ~/facts.yaml

      ---
      environment: 'production'
      fqdn: 'node01'
      virtual: 'virtualbox'
      timezone: 'PDT'
      

      $ facter virtual

      virtualbox
      

      No matter which variety I've tried to use for virtual - or any other fact for that matter - any hierarchy other than nodes or common is ignored. My agents always end up with the data in nodes/%{::trusted.certname}.yaml or common.yaml

      When using 'puppet lookup' it gets even more weird: only common.yaml is found.

      $ puppet lookup virt --explain --node node01 --facts ~/facts.yaml --debug
       
      Debug: Evicting cache entry for environment 'production'
      Debug: Caching environment 'production' (ttl = 0 sec)
      Debug: Performing a hiera indirector lookup of lookup_options with options {:variables=>Scope(Class[main]), :merge=>#<Puppet::Pops::HashMergeStrategy:0x00000004d5ef40 @options_t=#<Puppet::Pops::Types::PStructType:0x00000004d5b7a0 @elements=[#<Puppet::Pops::Types::PStructElement:0x00000004d5b7c8 @key_type=#<Puppet::Pops::Types::POptionalType:0x00000004d5b7f0 @type=#<Puppet::Pops::Types::PStringType:0x00000004d5b840 @size_type=nil, @values=["strategy"]>>, @value_type=#<Puppet::Pops::Types::POptionalType:0x00000004d5b958 @type=#<Puppet::Pops::Types::PPatternType:0x00000004d5b9a8 @patterns=[#<Puppet::Pops::Types::PRegexpType:0x00000004d5bac0 @pattern="hash", @regexp=/hash/>]>>>]>, @options={}>}
      Debug: hiera(): Hiera YAML backend starting
      Debug: hiera(): Looking up lookup_options in YAML backend
      Debug: hiera(): Looking for data source common
      Debug: Performing a hiera indirector lookup of virt with options {:variables=>Scope(Class[main]), :merge=>#<Puppet::Pops::FirstFoundStrategy:0x000000029790d0 @options_t=#<Puppet::Pops::Types::PStructType:0x000000029750c0 @elements=[#<Puppet::Pops::Types::PStructElement:0x000000029750e8 @key_type=#<Puppet::Pops::Types::POptionalType:0x00000002975110 @type=#<Puppet::Pops::Types::PStringType:0x00000002975188 @size_type=nil, @values=["strategy"]>>, @value_type=#<Puppet::Pops::Types::POptionalType:0x000000029752f0 @type=#<Puppet::Pops::Types::PPatternType:0x000000029753e0 @patterns=[#<Puppet::Pops::Types::PRegexpType:0x000000029755c0 @pattern="first", @regexp=/first/>]>>>]>, @options={}>}
      Debug: hiera(): Looking up virt in YAML backend
      Debug: hiera(): Looking for data source common
      Debug: hiera(): Found virt in common
      Data Binding "hiera"
        Found key: "virt" value: "common"
      

      No errors, log entries, ... whatsoever to be found.
      Any help trying to debug this would be greatly appreciated.

        Attachments

          Activity

            People

            Assignee:
            Arioch Tom De Vylder
            Reporter:
            Arioch Tom De Vylder
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support