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

Lookup unique merge doesn't deduplicate with a single layer - backport PUP 7608 to 4.10.z

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.10.9
    • Fix Version/s: PUP 4.10.10
    • Component/s: Hiera & Lookup
    • Labels:
      None
    • Template:
    • Sub-team:
    • Team:
      Platform Core
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      A lookup with {{unique}} would have no effect unless there was an actual merge of array values. Thus if a single array was found it could contain duplicates. This was fixed for Puppet 5 and now this fix is also made in Puppet 4.

      Description

      Ticket PUP-7608 was created against Puppet 5.0. This same issue also affects Puppet 4, and is a behavioral change from earlier Puppet 4 versions.

      Given a single hiera file containing

      ---
      foo:
        - this is a test
        - this is another test
        - this is a test
      

      In Puppet 4.2.3, hiera_array("foo") will return a two-element array:

      $ puppet apply -t --noop -e '$foo = hiera_array("foo"); notice("${::clientversion}: ${foo}")'
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Notice: Scope(Class[main]): 4.2.3: [this is a test, this is another test]
      Notice: Compiled catalog for foo.example.com in environment production in 0.32 seconds
      Info: Applying configuration version '1510798433'
      Notice: Applied catalog in 0.02 seconds
      

      However, in Puppet 4.10.8, it returns all three elements, including the duplicated element:

      $ puppet apply --strict=off -t --noop -e '$foo = hiera_array("foo"); notice("${::clientversion}: ${foo}")'
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Notice: Scope(Class[main]): 4.10.8: [this is a test, this is another test, this is a test]
      Notice: Compiled catalog for foo.example.com in environment production in 0.13 seconds
      Info: Applying configuration version '1510798413'
      Notice: Applied catalog in 0.04 seconds
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                JohnsonEarls Johnson Earls
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support