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

Regex Lookup isn't working with Puppet 4.9

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 4.9.4
    • PUP 4.10.0
    • None
    • None
    • OS: Ubuntu 14.04.5
      Puppet Agent: 1.9.3/4.9.4

    • Puppet Developer Experience
    • 1
    • PDE 2017-03-22, PDE 2017-04-05
    • Bug Fix
    • 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.
    • No Action
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support