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

Deep merge regression when a value of subkey is an alias or an hiera interpolation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: PUP 4.9.4
    • Fix Version/s: PUP 4.10.1
    • Component/s: None
    • Labels:
    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDE 2017-04-05, PDE 2017-04-19
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      The combination of a deep merge lookup and the use of an interpolation function in hiera data (alias, lookup, or hiera) could cause the deep merge to end without having performed a full search and silently produce a result where some values would be missing. This is now fixed.
      Show
      The combination of a deep merge lookup and the use of an interpolation function in hiera data (alias, lookup, or hiera) could cause the deep merge to end without having performed a full search and silently produce a result where some values would be missing. This is now fixed.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      covered by unit tests

      Description

      Hi,

      Here is the function which provides default data of my test module:

      function test::data (
        Hash                  $options,
        Puppet::LookupContext $context,
      ) {
       
        {
          test::param => { 'a' => 'a', 'b' => 'b' },
       
          lookup_options => {
             test::param => { merge => 'deep', },
          },
       
        }
       
      }
      

      Here is the my common.yaml file:

      ---
      foo: '123456'
      

      and here is my fqdn/$fqdn.yaml file:

      ---
      test::param:
        a: 'specific-a'
        c: 'specific-c'
      

      I'm using Hiera 5 with Puppet 4.9.4.

      With this config, I have the expected behavior:

      ~# puppet lookup 'test::param' 
      ---
      a: specific-a
      b: b
      c: specific-c
      

      Now I change my fqdn/$fqdn.yaml file to:

      ---
      # I insert an alias() interpolation in the value of the subkey "c".
      test::param:
        a: 'specific-a'
        c: '%{alias("foo")}'
      

      And now the deep merge works no longer:

      ~# puppet lookup 'test::param' 
      ---
      a: specific-a
      c: '123456'
      

      It seems to be the result with the first merge policy, not deep.

      1. If I insert a hiera() interpolation, I have the same problem.
      2. I have tested with the eyaml backend and the standard yaml_data backend, same problem.
      3. I'm sure it worked with puppet-agent 1.8.2 ie Puppet version 4.8.1 because it was the case in my production server.

      Regards.

        Attachments

        1. PUP-7418.sh
          33 kB
        2. pup-7418.tar.gz
          1 kB
        3. pup-7418.zip
          3 kB

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                flaf Francois Lafont
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support