Can't knockout value

閲覧: 34 回
最初の未読メッセージにスキップ

Helmut Schneider

未読、
2022/03/24 5:13:342022/03/24
To: puppet...@googlegroups.com
Hi,

my 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 Systems"
paths:
- "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
- "%{::operatingsystem}-%{::virtual}.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:
- cron
- environment_files::common
- environment_files::%{facts.operatingsystem}
- logrotate
- my_facts
- my_perl
- my_puppet
- my_snmpd
- my_sudo
- openntpd
- openssh
- shell_scripts::install
- users

config.pp:
[...]
class config {
$classes = lookup({
"name" => "classes",
"merge" => {
"strategy" => "deep",
"knockout_prefix" => "--",
"sort_merged_arrays" => true,
},
"default_value" => {},
})
[...]

I'm trying to knockout "opennntpd". This works on CentOS in CentOS.yaml:

---
[...]
classes:
- --openntpd
- my_ntpd

but not in Ubuntu-openvzve.yaml:

---
[...]
classes:
- --openntpd
- my_ntpd

helmut@puppet:/etc/puppetlabs/code/environments/production/hieradata$
sudo grep -ir openntpd .
./common.yaml: - openntpd
./Ubuntu-openvzve.yaml: - --openntpd
./CentOS.yaml: - --openntpd
helmut@puppet:/etc/puppetlabs/code/environments/production/hieradata$

Ubuntu-openvzve.yaml is read successfully, if I enter a bogus value it
get's evaluated.

helmut@h2873756:~$ facter operatingsystem virtual
operatingsystem => Ubuntu
virtual => openvzve
helmut@h2873756:~$

How can I debug further?

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

Thank you!

Tim Skirvin

未読、
2022/03/24 10:18:482022/03/24
To: puppet...@googlegroups.com
Helmut Schneider <jump...@gmx.de> writes:

> paths:
> - "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
> - "%{::operatingsystem}-%{::virtual}.yaml"
> - "%{::operatingsystem}.yaml"
> - "%{::kernel}.yaml"

> I'm trying to knockout "opennntpd". This works on CentOS in CentOS.yaml:

I've got a very different hiera layout than you, but I've run into
this problem as well, and I also haven't been able to find a good way to
describe it well enough to file a bug about it. FYI. I set:

- name: "zone/role/subrole + common"
paths:
- "zones/%{zone}/%{role}/%{subrole}.yaml"
- "zones/%{zone}/%{role}.yaml"
- "zones/%{zone}.yaml"
- common.yaml

From memory: subrole can knock out from role, but it can't knock
out from zone or common. Role can knock out from zone but not from
common. Zone can knock out from common.

- Tim Skirvin (tski...@fnal.gov)
--
Fermilab SCF-SSI - HPC Architect He, Him, His

Helmut Schneider

未読、
2022/03/25 6:43:492022/03/25
To: puppet...@googlegroups.com
Am 24.03.2022 um 15:18 schrieb Tim Skirvin:
> Helmut Schneider <jump...@gmx.de> writes:
>
>> paths:
>> - "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
>> - "%{::operatingsystem}-%{::virtual}.yaml"
>> - "%{::operatingsystem}.yaml"
>> - "%{::kernel}.yaml"
>
>> I'm trying to knockout "opennntpd". This works on CentOS in CentOS.yaml:
>
> I've got a very different hiera layout than you, but I've run into
> this problem as well, and I also haven't been able to find a good way to
> describe it well enough to file a bug about it. FYI. I set:
>
> - name: "zone/role/subrole + common"
> paths:
> - "zones/%{zone}/%{role}/%{subrole}.yaml"
> - "zones/%{zone}/%{role}.yaml"
> - "zones/%{zone}.yaml"
> - common.yaml

Interesting, I changed the order in hiera.yaml to

>> paths:
>> - "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
>> - "%{::operatingsystem}.yaml"
>> - "%{::kernel}.yaml"
>> - "%{::operatingsystem}-%{::virtual}.yaml"

and the value get's knocked out. Unfortunately now values higher in
hiera.yaml don't. I created a bug report.

全員に返信
投稿者に返信
転送
新着メール 0 件