Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml
Title: Message Title Tejas Rao commented on PUP-11194 Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml hostgroup is a top level variable passed by external ENC (foreman). hostgroup variable passed from foreman is resolved correctly in classes using $::hostgroup but not resolving in hiera.yaml (%{::hostgroup}) [root@master06 ~]# sudo -u puppet /etc/puppetlabs/puppet/node.rb node1.example.com | grep hostgroup hostgroup: bnlboxgpfs [root@master06 ~]# Add Comment This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.409306.1627694628000.100065.1628170020028%40Atlassian.JIRA.
Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml
Title: Message Title Tejas Rao commented on PUP-11194 Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml [root@master06 ~]# puppet lookup puppet_agent::package_version --node node1.example.com --environment production --strict_variables --trace --explain Warning: Undefined variable '::hostgroup'; (file & line not available) Searching for "lookup_options" Global Data Provider (hiera configuration version 5) No such key: "lookup_options" Environment Data Provider (hiera configuration version 5) Using configuration "/etc/puppetlabs/code/environments/production/hiera.yaml" Merge strategy hash Hierarchy entry "Per-node data" Path "/etc/puppetlabs/code/environments/production/hieradata/node1.example.com.yaml" Original path: "%{trusted.certname}.yaml" Path not found Hierarchy entry "Host Group Data" Path "/etc/puppetlabs/code/environments/production/hieradata/.yaml" Original path: "%{::hostgroup}.yaml" Path not found Hierarchy entry "linuxfarm Per-node data" Path "/etc/puppetlabs/code/environments/production/linuxfarm/hieradata/node1.example.com.yaml" Original path: "%{trusted.certname}.yaml" Path not found Hierarchy entry "linuxfarm Host Group Data" Path "/etc/puppetlabs/code/environments/production/linuxfarm/hieradata/RedHat.yaml" Original path: "%{::osfamily}.yaml" Path not found Hierarchy entry "Secret data (encrypted)" Path "/etc/puppetlabs/code/environments/production/hieradata/secure.yaml" Original path: "secure.yaml" Path not found Hierarchy entry "linuxfarm Common data" Path "/etc/puppetlabs/code/environments/production/linuxfarm/hieradata/common.yaml" Original path: "common.yaml" Path not found Hierarchy entry "Common Data" Path "/etc/puppetlabs/code/environments/production/hieradata/common.yaml" Original path: "common.yaml" No such key: "lookup_options" Module data provider for module "puppet_agent" not found Searching for "puppet_agent::package_version" Global Data Provider (hiera configuration version 5) No such key: "puppet_agent::package_version" Environment Data Provider (hiera configuration version 5) Using configuration "/etc/puppetlabs/code/environments/production/hiera.yaml" Hierarchy entry "Per-node data" Path "/etc/puppetlabs/code/environments/production/hieradata/node1.example.com.yaml" Original path: "%{trusted.certname}.yaml" Path not found Hierarchy entry "Host Group Data" Path "/etc/puppetlabs/code/environments/production/hieradata/.yaml" Original path: "%{::hostgroup}.yaml" Path not found Hierarchy entry "linuxfarm Per-node data" Path "/etc/puppetlabs/code/environments/production/linuxfarm/hieradata/node1.example.com.yaml" Original path: "%{trusted.certname}.yaml" Path not found Hierarchy entry "linuxfarm Host Group Data" Path "/etc/puppetlabs/code/environments/production/linuxfarm/hieradata/RedHat.yaml" Original path: "%{::osfamily}.yaml" Path not found Hierarchy entry "Secret data (encrypted)" Path "/etc/puppetlabs/code/environments/production/hieradata/secure.yaml" Original path: "secure.yaml" Path not found Hierarchy entry "linuxfarm Common data" Path "/etc/puppetlabs/code/environments/production/linuxfarm/hieradata/common.yaml" Original path: "common.yaml" Path not found Hierarchy entry "Common Data" Path "/etc/puppetlabs/code/environments/production/hieradata/common.yaml" Original path: "common.yaml" Found key: "puppet_agent::package_version" value: "6.24.0-1.el8" [root@master06 ~]# You can see that other variables such as ::osfamily and ::environment resolve correctly using hiera 5
Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml
Title: Message Title Tejas Rao commented on PUP-11194 Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml It does work on our old puppet server running a very old version (puppet 3). The puppet server was installed using the foreman installer, nothing special was done and it is a rather standard setup. Using the below versions - foreman-2.3.5-1.el7.noarch puppet-agent-6.24.0-1.el7.x86_64 puppetserver-6.16.1-1.el7.noarch [root@master06 ~]# hiera -V 3.7.0 [root@master06 ~]# [root@master06 ~]# cat /etc/puppetlabs/code/environments/production/hiera.yaml version: 5 defaults: # Used for any hierarchy level that omits these keys. datadir: hieradata # This path is relative to hiera.yaml's directory. data_hash: yaml_data # Use the built-in YAML backend. hierarchy: name: "Per-node data" # Human-readable name. path: "%{trusted.certname}.yaml" name: "Host Group Data" path: "%{::hostgroup}.yaml" Add Comment This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.409306.1627694628000.96241.1627914600168%40Atlassian.JIRA.
Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml
Title: Message Title Tejas Rao created an issue Puppet / PUP-11194 Global variable hostgroup passed from foreman is not resolved in hiera.yaml Issue Type: Bug Affects Versions: PUP 7.8.0 Assignee: Unassigned Components: Hiera & Lookup Created: 2021/07/30 6:23 PM Priority: Normal Reporter: Tejas Rao Puppet Version:7.9.0-1 Puppet Server Version:7.2.1-1 OS Name/Version:RHEL7.9 hostgroup variable passed from foreman is resolved correctly in classes using $::hostgroup but not resolving in hiera.yaml (%{::hostgroup}) Puppet lookup complains with the below error - Warning: Undefined variable '::hostgroup'; (file & line not available) With --explain , you can see that variable is not resolving. Hierarchy entry "Host Group Data" Path "/etc/puppetlabs/code/environments/production/hieradata/.yaml" Original path: "%{::hostgroup}.yaml" Path not found Desired Behavior: Variable should resolve correctly. Actual Behavior: [root@master06 bin]# puppet lookup puppet_agent::package_version --node node22 --environment raot Warning: Undefined variable '::hostgroup'; (file & line not available) — 6.24.0-1.el8 [root@master06 bin]#