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

Regex Lookup isn't working with Puppet 4.9

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.9.4
    • Fix Version/s: PUP 4.10.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      OS: Ubuntu 14.04.5
      Puppet Agent: 1.9.3/4.9.4

    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDE 2017-03-22, PDE 2017-04-05
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      If all keys specifying {{lookup_options}} in hiera data files were based on regular expression patterns, puppet would crash. This is now fixed. A work around while waiting for the fix is to add a lookup options for a dummy fixed key.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      covered by unit tests

      Description

      UPDATE


      When regular expression keys are using in lookup_options an error is raised if all of the lookup_option keys are regular expression.
      A work around until this is fixed is to add a dummy, non regular expression key.

      ORIGINAL


      root@mbaur-hieradebug:/etc/puppetlabs/code/environments/production# cat hiera.yaml
      version: 5
      defaults:
        datadir: hieradata
        data_hash: yaml_data
      hierarchy:
        - name: "Per-node data (yaml version)"
          path: "nodes/%{trusted.certname}.yaml" # Add file extension.
          # Omitting datadir and data_hash to use defaults.
       
        - name: "Other YAML hierarchy levels"
          paths: # Can specify an array of paths instead of one.
            - "location/%{facts.whereami}/%{facts.group}.yaml"
            - "groups/%{facts.group}.yaml"
            - "os/%{facts.os.family}.yaml"
            - "common.yaml"
      root@mbaur-hieradebug:/etc/puppetlabs/code/environments/production# cat hieradata/common.yaml
      ---
      classes:
        - foobar
      lookup_options:
        "^profile::(.*)::users$": # Regexp: `$users` parameter of any profile class
          merge:          # Merge behavior as a hash
            strategy: deep
            merge_hash_arrays: true
      root@mbaur-hieradebug:/etc/puppetlabs/code/environments/production# puppet lookup classes
      Error: Could not run: undefined method `[]' for nil:NilClass
      

      The following things has been changed compared to an pure puppet-agent installation:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                baurmatt Matthias Baur
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support