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

Knock-out-prefix fails with more than 3 hierarchy levels

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Hiera & Lookup
    • Needs Assessment
    • 47851
    • 1
    • Needs Assessment

    Description

      When defining multiple levels of hierarchy in hiera.yaml (3 or more), and requesting hiera to lookup a key that is found on at least 3 levels, and lookup options for that key are configured to merge deep with a knockout prefix, the merge fails to knockout the key matching the higher precedence knockout.

      Steps to reproduce:

      hiera.yaml:
       version: 5
       defaults:         
         datadir: data
         data_hash: yaml_data
       
       hierarchy:
         - name: node specific data
           path: node/%{::site.node}.yaml
       
         - name: product data
           path: product/%{::site.product}.yaml
       
         - name: os data
           path: os/%{::os.family}.yaml
       
         - name: global data
           path: common.yaml
      	
      common.yaml:
        lookup_options:
          classes:
            merge:
              strategy: deep
              knockout_prefix: --
        classes:
          - profiles::motd
          - profiles::network
       
      os/RedHat.yaml:
        classes:
          - profiles::yum
       
      product/product.yaml
       classes:
         - profiles::application
       
      node/node.yaml:
       classes:
         - --profiles::network
         - network
      

      Expected

      puppet lookup --knock-out-prefix '--' --merge deep classes
      ---
      - profiles::motd
      - profiles::yum
      - profiles::application
      - network
      

      Actual

      puppet lookup --knock-out-prefix '--' --merge deep classes
      ---
      - profiles::motd
      - profiles::network
      - profiles::yum
      - profiles::application
      - network
      

      Removing a layer from the hierarchy causes the merge to behave as expected. The difference being:

      puppet lookup --knock-out-prefix '--' --merge deep classes | grep 'Found key:' | wc -l
      4
      

      vs

      puppet lookup --knock-out-prefix '--' --merge deep classes | grep 'Found key:' | wc -l
      3
      

      Verified Affected Versions
      Puppet 4.10.0
      Puppet 4.10.9
      Puppet 5.3.1

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rstruber Ryan Struber
              Votes:
              5 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support