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

Lookup doesn't interpolate values into top level (hash) keys

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: PUP 4.8.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      It appears that lookup doesn't interpolate values into the keys of hashes whereas it works with hiera. For example:

      testhash:
        "%{osfamily}":
          subkey: "%{osfamily}"
          "%{osfamily}": "value"
      

      With lookup, I get:

      # puppet lookup --environment=gitlab_runner_lookup --node <certname> --explain testhash
      Merge strategy first
        Data Binding "hiera"
          No such key: "testhash"
        Data Provider "Hiera Data Provider, version 4"
          ConfigurationPath "/etc/puppetlabs/code/environments/gitlab_runner_lookup/hiera.yaml"
          Data Provider "Nodes"
            Path "/etc/puppetlabs/code/environments/gitlab_runner_lookup/hieradata/nodes/<certname>.yaml"
              Original path: "nodes/%{trusted.certname}"
              Interpolation on "%{osfamily}"
                Global Scope
                  Found key: "osfamily" value: "Debian"
              Found key: "testhash" value: {
                "%{osfamily}" => {
                  "subkey" => "Debian",
                  "%{osfamily}" => "value"
                }
              }
        Merged result: {
          "%{osfamily}" => {
            "subkey" => "Debian",
            "%{osfamily}" => "value"
          }
        }
      

      And with environment data disabled, hiera returns:

      # puppet lookup --environment=gitlab_runner_lookup --node <certname> --explain testhash
      Data Binding "hiera"
        Found key: "testhash" value: {
          "Debian" => {
            "subkey" => "Debian",
            "Debian" => "value"
          }
        }
      

      UPDATE


      This is per design - it does not make sense to interpolate into the top level keys. It is considered a bug in the hiera interpolation - it was never intended to work.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                dsung Daniel Sung
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support