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

Allow keys to be specified by pattern in lookup_options

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.9.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide

      That a pattern based key can be used to match many keys. That explicit verbatim keys wins over pattern keys on a layer by layer basis.

      Show
      That a pattern based key can be used to match many keys. That explicit verbatim keys wins over pattern keys on a layer by layer basis.
    • Team:
      Puppet Developer Experience
    • Story Points:
      2
    • Sprint:
      PDE 2017-01-11
    • Release Notes:
      New Feature
    • Release Notes Summary:
      It is now possible to specify {{lookup_options}} using a regular expression for the keys the options apply to. The regular expression must start with a '^' to be recognized as a regular expression.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      covered by unit tests

      Description

      Allow keys to be specified by pattern in lookup_options. The reason for wanting this feature is that can become very tedious to specify all keys. While not a big deal when constructing new logic, it becomes a real chore when moving from a hiera.yaml with global merge behavior specified as that potentially could mean adding thousands of entries if moving the hierarchy to an environment hiera 5 hiera.yaml.

      It is also a chore having to list a large number of parameters for classes such as apache where it would be beneficial to state one pattern that applies to the majority and then single out those that are different.

      The rules for the pattern based entries are as follows:

      • if a key is specified with an exact match it wins over one specified with a pattern in the same layer - this makes it easier to handle exclusions
      • if a key is specified with a pattern, the first pattern that matches in a layer wins (subsequent patterns in the same layer are ignored).
      • patterns are regular expressions
      • a key is a pattern if the key starts with ^
      • as the lookup options are merged - a pattern match key is merged with an identical pattern match in a higher layer - thus '^mymodule::.*' in a global layer merges with '^mymodule::.*' in the environment layer, but '^my[m]odule::.*' would not merge.
      • It is forbidden for a module to include pattern based keys that are not prefixed with the module name.
      • A lookup_option specifying merge for a key trumps the global merge behavior specified in a hiera.yaml version 3 (versions 4 and 5 does not support the global setting).
      • A lookup_option given explicitly in a call to lookup wins over data specified and hiera.yaml specified merge options.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              henrik.lindberg Henrik Lindberg
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support