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

Merge of lookup_options not working

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • PUP 5.5.14
    • None
    • Hiera & Lookup
    • None
    • Needs Assessment
    • Needs Assessment

    Description

      Puppet Version: 5.5.14
      Puppet Server Version: 5.3.8
      OS Name/Version: RHEL 7.x

      In our Hiera data, we have made use of lookup_options to control the merge behaviour, so in our catch-all common.yaml there are entries such as:

      ---
      lookup_options:
        profile::autofs::mounts:
          merge: hash 

      This works as desired. However we have some exceptions where we want to override this on a per-role basis back to the original "first" behaviour, so as we have a higher priority role level, I added the following in a role/foo.yaml:

      ---
      lookup_options:
        profile::autofs::mounts:
          merge: first 

      If I use the "puppet lookup" command against the correct host, this appears to work as desired, using `--explain-options` I get the following result:

        Merged result: {
          "profile::autofs::mounts" => {
            "merge" => "first"
          }
        }

      For any other hosts I still get the behaviour defined at the common level:

        Merged result: {
          "profile::autofs::mounts" => {
            "merge" => "hash"
          }
        } 

      All good. However this doesn't seem to actually apply to the lookup itself:

      Using merge options from "lookup_options" hash
      Searching for "profile::autofs::mounts"  Merge strategy hash
        ... 

      It only ever picks up the behaviour defined at the common level.

      Desired Behavior:

      I would expect to see:

      Using merge options from "lookup_options" hash
      Searching for "profile::autofs::mounts"  ... 

      i.e. (no merge strategy displayed here)

      Actual Behavior:

      One bit of information that might be relevant is that in order for our lookups to work from the CLI, I have to use the --compile option, so basically something like:

      puppet lookup --compile --environment <env> --node <node> profile::autofs::mounts --explain(-options)

      We have multiple backends/levels configured in Hiera, a mix of YAML/eYAML and using the HTTP backend too.

       

      I noticed there was PUP-7037 which was raised for similar behaviour but was ultimately traced to a typo. I'm confident this isn't down to a typo.

       

      Edit: After a bit more experimenting, I was a bit confused about where "hash" should be printed vs other merge strategies, the 'Using merge options from "lookup_options" hash' is pretty much a fixed string, it's the presence/lack of "Merge strategy ..." that is the identifier.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bodgit Matt Dainty
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support