Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-07-30 Thread Tejas Rao (Jira)
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]#  
 

  
 
 
 
 

 
 
 

 
 

Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-08-02 Thread Ciprian Badescu (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Ciprian Badescu commented on  PUP-11194  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml   
 

  
 
 
 
 

 
 Tejas Rao, Can you provide us a simple was to reproduce this error? Did it worked on earlier puppet versions?  
 

  
 
 
 
 

 
 
 

 
 
 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.96198.1627913580253%40Atlassian.JIRA.


Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-08-02 Thread Tejas Rao (Jira)
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

2021-08-02 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-11194  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml   
 

  
 
 
 
 

 
 Tejas Rao I suspect the issue is related to how exactly the hostgroup variable is defined. See the caution in https://puppet.com/docs/puppet/6/hiera_merging.html#interpolate_puppet_variable about "pseudo-variables" Also I'd suggest adding the --explain option to `puppet lookup`  
 

  
 
 
 
 

 
 
 

 
 
 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.96922.1627939440130%40Atlassian.JIRA.


Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-08-03 Thread Tejas Rao (Jira)
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

2021-08-03 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-11194  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml   
 

  
 
 
 
 

 
 osfamily and environment are builtin facts, but hostgroup is not. Where is that variable defined?  
 

  
 
 
 
 

 
 
 

 
 
 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.98027.1628011080112%40Atlassian.JIRA.


Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-08-05 Thread Tejas Rao (Jira)
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

2021-08-17 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-11194  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml   
 

  
 
 
 
 

 
 I can't reproduce. I have a simple ENC script that always prints:  
 
 
 
 
 # /etc/puppetlabs/puppet/node.rb node1.example.com  
 
 
 ---  
 
 
 classes:  
 
 
   group:  
 
 
 parameters:  
 
 
   hostgroup: group1  
 
 
 environment: env11194
  
 
 
 
  Hiera is configured to resolve the hierarchy using the hostgroup top-scope variable returned by the ENC:  
 
 
 
 
 # cat /etc/puppetlabs/code/environments/env11194/hiera.yaml  
 
 
 ---  
 
 
 version: 5  
 
 
 hierarchy:  
 
 
   - name: "Host Group Data"  
 

Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-09-13 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-11194  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml   
 

  
 
 
 
 

 
 Ah I was able to reproduce. I think the key is that you must use the compile option since the hierarchy using facts. See the CLI help:  
 
 
 
 
 * --compile  
 
 
   Perform a full catalog compilation prior to the lookup. If your hierarchy and  
 
 
   data only use the $facts, $trusted, and $server_facts variables, you don't  
 
 
   need this option; however, if your Hiera configuration uses arbitrary  
 
 
   variables set by a Puppet manifest, you might need this option to get accurate  
 
 
   data. No catalog compilation takes place unless this flag is given.
  
 
 
 
  Please give that a try and close this out if it's resolved.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 
 

Jira (PUP-11194) Global variable hostgroup passed from foreman is not resolved in hiera.yaml

2021-11-10 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-11194  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Global variable hostgroup passed from foreman is not resolved in hiera.yaml   
 

  
 
 
 
 

 
 I'm going to close this out based on my last comment. Please reopen if this is still an issue when using the --compile option.  
 

  
 
 
 
 

 
 
 

 
 
 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.4674.1636603740036%40Atlassian.JIRA.