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

puppet lookup ignores --hiera_config option

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: PUP 4.8.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      Puppet Developer Experience
    • Sprint:
      Forge - To Accept

      Description

      It seems that the puppet lookup command ignores the --hiera_config option.

      When I'm hacking on a control-repo I want to be able to test that the per-environment hiera.yaml file at the top level of the control-repo works in isolation, that is I don't want to have to deploy the code to a puppet master in order to test that the data lookups are working correctly.

      Steps to reproduce:

      In an arbitrary directory, set up the following structure:

      hiera.yaml
      hieradata/base.yaml

      Put the following into these files:

      hiera.yaml:

      ---
      version: 4
      datadir: hieradata
       
      hierarchy:
        - name: "nodes/%{::fqdn}"
          backend: yaml
        - name: base
          backend: yaml
      

      hieradata/base.yaml

      ---
      message: "Testing"
      

      Try and perform a lookup:

      puppet lookup --hiera_config hiera.yaml message
      

      Expected result: "Testing"

      Actual result: ""

      Trying to get some debug info:

      $ puppet lookup --debug --hiera_config hiera.yaml message | grep hieradata
      Debug: hiera(): Cannot find datafile /etc/puppetlabs/code/environments/production/hieradata/nodes/so-much-for-subtlety.local.yaml, skipping
      Debug: hiera(): Cannot find datafile /etc/puppetlabs/code/environments/production/hieradata/common.yaml, skipping
      

      This shows the hiera.yaml file isn't being read and used for the hiera lookup component of puppet lookup, although the option was recognised:

      $ puppet lookup --debug --hiera_config hiera.yaml message | grep hiera_config
      Debug: Using settings: adding file resource 'hiera_config': 'File[/Users/jesse/tmp/hiera_test/hiera.yaml]{:path=>"/Users/jesse/tmp/hiera_test/hiera.yaml", :ensure=>:file, :loglevel=>:debug, :links=>:follow, :backup=>false}'
      

      And:

      $ puppet lookup --hiera_config hiera.yaml --configprint hiera_config
      /Users/jesse/tmp/hiera_test/hiera.yaml
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  jesse.reynolds Jesse Reynolds
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support