Jira (HI-349) Puppet to Hiera Lookup

4 views
Skip to first unread message

matt scialabba (JIRA)

unread,
Mar 12, 2015, 12:23:32 PM3/12/15
to puppe...@googlegroups.com
matt scialabba created an issue
 
Hiera / Bug HI-349
Puppet to Hiera Lookup
Issue Type: Bug Bug
Affects Versions: HI 1.3.4
Assignee: Unassigned
Components: Community
Created: 2015/03/12 9:22 AM
Environment:

Linux puppetmaster-test 2.6.32-431.29.2.el6.x86_64 #1 SMP Tue Sep 9 21:36:05 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
hiera-1.3.4-1.el6.noarch
puppet-3.7.4-1.el6.noarch

Priority: Normal Normal
Reporter: matt scialabba

This test involves /etc/issue.

In this example is_test returns true.

/var/lib/hiera/common.yaml:
classes:

  • config::issue
    config::issue::content: 'puppet:///modules/config/issue'

/var/lib/hiera/test_%{::is_test}/common.yaml
config::issue::content: 'puppet:///modules/config/issue-test'

/etc/puppet/manifests/site.pp
hiera_include('classes')

/etc/puppet/modules/config/manifests/issue.pp
class config::issue ( $content ) {
tag 'config_issue'

file

{ '/etc/issue': ensure => file, group => 'root', mode => '0644', owner => 'root', seluser => 'system_u', selrole => 'object_r', seltype => 'etc_t', source => "$content"; }

}

In this format, everything works as expected. The following does not work as expected.

class config::issue {
tag 'config_issue'

$content = hiera('config::issue::content')

file

{ '/etc/issue': ensure => file, group => 'root', mode => '0644', owner => 'root', seluser => 'system_u', selrole => 'object_r', seltype => 'etc_t', source => "$content"; }

}

In the first example, the content of issue-test is pulled down. In the second example, the content of issue is pulled down. According to http://docs.puppetlabs.com/hiera/1/puppet.html#limitations it should be doing a priority lookup on the parameter as passed. Also, according to http://docs.puppetlabs.com/hiera/1/puppet.html#hiera-lookup-functions hiera() is doing a standard priority lookup.

What I don't understand is, why does one way return issue-test and the other does not? If I am incorrect on any assumptions, I'd ask for some clarification.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a)
Atlassian logo

matt scialabba (JIRA)

unread,
Mar 12, 2015, 12:24:25 PM3/12/15
to puppe...@googlegroups.com
matt scialabba updated an issue
Change By: matt scialabba
This test involves /etc/issue.

In this example is_test returns true.

/var/lib/hiera/common.yaml:
classes:
  - config::issue

Henrik Lindberg (JIRA)

unread,
Mar 12, 2015, 5:51:38 PM3/12/15
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
This test involves /etc/issue.

In this example is_test returns true.
{code}
# /var/lib/hiera/common.yaml:

classes:
  - config::issue

config::issue::content: 'puppet:///modules/config/issue'
{code}
{code}
#
/var/lib/hiera/test_%{::is_test}/common.yaml

config::issue::content: 'puppet:///modules/config/issue-test'
{code}
{code}
#
/etc/puppet/manifests/site.pp :
hiera_include('classes')
{code}
{code}
#
/etc/puppet/modules/config/manifests/issue.pp

class config::issue ( $content ) {
  tag 'config_issue'

  file {
    '/etc/issue':
      ensure  => file,
      group   => 'root',
      mode    => '0644',
      owner   => 'root',
      seluser => 'system_u',
      selrole => 'object_r',
      seltype => 'etc_t',
      source  => "$content";
  }
}
{code}
In this format, everything works as expected. The following does not work as expected.

{code}
class config::issue {
  tag 'config_issue'

  $content = hiera('config::issue::content')

  file {
    '/etc/issue':
      ensure  => file,
      group   => 'root',
      mode    => '0644',
      owner   => 'root',
      seluser => 'system_u',
      selrole => 'object_r',
      seltype => 'etc_t',
      source  => "$content";
  }
}
{code}
In the first example, the content of issue-test is pulled down. In the second example, the content of issue is pulled down. According to http://docs.puppetlabs.com/hiera/1/puppet.html#limitations it should be doing a priority lookup on the parameter as passed. Also, according to http://docs.puppetlabs.com/hiera/1/puppet.html#hiera-lookup-functions hiera() is doing a standard priority lookup.

What I don't understand is, why does one way return issue-test and the other does not? If I am incorrect on any assumptions, I'd ask for some clarification.

Henrik Lindberg (JIRA)

unread,
Mar 12, 2015, 5:57:27 PM3/12/15
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
Mar 12, 2015, 6:02:38 PM3/12/15
to puppe...@googlegroups.com
Henrik Lindberg commented on Bug HI-349
 
Re: Puppet to Hiera Lookup

Maybe because the second case is a recursive call to hiera from within hiera_classes. What happens if you lookup the content before you call hiera_include() ? (Just as a test) Does that produce the correct content?

Also, are you 100% sure the is_test is set in the second case. Try hardcoding it instead of using a variable.

Henrik Lindberg (JIRA)

unread,
Mar 12, 2015, 6:03:26 PM3/12/15
to puppe...@googlegroups.com
Henrik Lindberg assigned an issue to matt scialabba
Change By: Henrik Lindberg
Assignee: matt scialabba

Josh Cooper (Jira)

unread,
Feb 17, 2022, 2:10:01 AM2/17/22
to puppe...@googlegroups.com
Josh Cooper commented on Bug HI-349

The hiera functions are deprecated so I’m going to close this.

This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages