Jira (HI-630) Issues knocking out hiera values

3 views
Skip to first unread message

Helmut Ritter (Jira)

unread,
Mar 25, 2022, 6:08:02 AM3/25/22
to puppe...@googlegroups.com
Helmut Ritter created an issue
 
Hiera / Bug HI-630
Issues knocking out hiera values
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2022/03/25 3:07 AM
Environment:

helmut@puppet:~$ lsb_release -d
Description:    Ubuntu 20.04.4 LTS
helmut@puppet:~$ puppet -V
7.14.0
helmut@puppet:~$ hiera -V
3.8.0
helmut@puppet:~$

Priority: Normal Normal
Reporter: Helmut Ritter

Given the following hera.yaml:

 


version: 5

defaults:
  datadir:   /etc/puppetlabs/code/environments/%{::environment}/hieradata
  data_hash: yaml_data

hierarchy:
  - name:  "Nodes"
    path:  "nodes/%{::fqdn}.yaml"
  - name:  "Domains"
    globs:
      - "domains/%{::domain}/*.yaml"
  - name:  "Operating Systems"
    paths:
      - "%{::operatingsystem}-%{::virtual}.yaml"
      - "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
      - "%{::operatingsystem}.yaml"
      - "%{::kernel}.yaml"
  - name:  "Roles"
    path:  "roles.yaml"
  - name:  "Profiles"
    path:  "profiles.yaml"
  - name:  "Applications"
    globs:
      - "apps/*.yaml"
  - name:  "Common settings"
    path:  "common.yaml"

 

common.yaml:

lookup_options:
  classes:
    merge:
      strategy:          'deep'
      knockout_prefix:   '–'
[...]
classes:
[...]
 - openntpd

 

The value "openntpd" can be knocked out via "- -openntpd" both from "%{::kernel}.yaml" and "%{::operatingsystem}.yaml" but not from "%{::operatingsystem}%{::operatingsystemrelease}.yaml" or later anymore. If I change order in hiera.yaml to:

 

  - name:  "Operating Systems"
    paths:
      - "%{::operatingsystem}-%{::virtual}.yaml"
      - "%{::operatingsystem}.yaml"
      - "%{::kernel}.yaml"
      - "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"

 

"openntpd" get's knocked out from "%{::operatingsystem}-%{::operatingsystemrelease}.yaml" and "%{::kernel}.yaml" but not from "%{::operatingsystem}.yaml" and later.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Helmut Ritter (Jira)

unread,
Mar 25, 2022, 7:03:02 AM3/25/22
to puppe...@googlegroups.com
Helmut Ritter commented on Bug HI-630
 
Re: Issues knocking out hiera values

To reproduce:

 

hiera.yaml:

version: 5

defaults:
  datadir:   /etc/puppetlabs/code/environments/%{::environment}/hieradata
  data_hash: yaml_data

hierarchy:
  - name:  "Nodes"
    path:  "nodes/%{::fqdn}.yaml"
  - name:  "Domains"
    globs:
      - "domains/%{::domain}/*.yaml"

  - name:  "Operating System Release"
    path:  "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
  - name:  "Operating System"
    path:  "%{::operatingsystem}.yaml"
  - name:  "Kernel"
    path:  "%{::kernel}.yaml"
  - name:  "Operating System Platform"
    path:  "%{::operatingsystem}-%{::virtual}.yaml"


  - name:  "Roles"
    path:  "roles.yaml"

  - name:  "Applications"
    globs:
      - "apps/*.yaml"
  - name:  "Common settings"
    path:  "common.yaml"

 

common.yaml:

lookup_options:
  knockout:
    merge:
      strategy:          'deep'
      knockout_prefix:   '–'
knockout:
  - common
  - roles
  - kernel
  - operatingsystem-virtual
  - operatingsystem-operatingsystemrelease
  - node

roles.yaml:


knockout:
  - --roles

 

kernel.yaml:


knockout:
  - --kernel

 

operatingsystem-virtual.yaml:


knockout:
  - --operatingsystem-virtual

 

Result ("roles" got knocked out):

[helmut@BSDHelmut ~]$ sudo puppet agent -t -v
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for bsdhelmut.charlieroot.de
Info: Applying configuration version '1648205634'
Notice: [common, kernel, operatingsystem-virtual, operatingsystem-operatingsystemrelease, node]
Notice: /Stage[main]/Config/Notify[Knockout:]/message: defined 'message' as '[common, kernel, operatingsystem-virtual, operatingsystem-operatingsystemrelease, node]'
Notice: Applied catalog in 19.34 seconds
[helmut@BSDHelmut ~]$

 

Now change order in hiera.yaml and put "kernel.yaml" somewhere lower:


version: 5

defaults:
  datadir:   /etc/puppetlabs/code/environments/%{::environment}/hieradata
  data_hash: yaml_data

hierarchy:
  - name:  "Nodes"
    path:  "nodes/%{::fqdn}.yaml"
  - name:  "Domains"
    globs:
      - "domains/%{::domain}/*.yaml"

  - name:  "Operating System Release"
    path:  "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
  - name:  "Operating System"
    path:  "%{::operatingsystem}.yaml"

  1.  - name:  "Kernel"
  2.    path:  "%{::kernel}.yaml"
      - name:  "Operating System Platform"
        path:  "%{::operatingsystem}-%{::virtual}.yaml"

  1.   - name:  "Roles"
        path:  "roles.yaml"
  1.   - name:  "Kernel"
        path:  "%{::kernel}.yaml"

  1.   - name:  "Applications"
        globs:
          - "apps/*.yaml"
      - name:  "Common settings"
        path:  "common.yaml"

 

Result ("kernel" got knocked out but "roles" didn't):

Notice: [common, roles, operatingsystem-virtual, operatingsystem-operatingsystemrelease, node]
Notice: /Stage[main]/Config/Notify[Knockout:]/message: defined 'message' as '[common, roles, operatingsystem-virtual, operatingsystem-operatingsystemrelease, node]'

Reply all
Reply to author
Forward
0 new messages