Jira (PUP-11726) Allow Puppet function calls from hiera data

12 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Jan 26, 2023, 11:43:02 AM1/26/23
to puppe...@googlegroups.com
Josh Cooper moved an issue
 
Puppet / Improvement PUP-11726
Allow Puppet function calls from hiera data
Change By: Josh Cooper
Key: HI PUP - 638 11726
Project: Hiera Puppet
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
Jan 26, 2023, 11:43:03 AM1/26/23
to puppe...@googlegroups.com

Michael Hashizume (Jira)

unread,
Feb 7, 2023, 4:37:03 PM2/7/23
to puppe...@googlegroups.com

Michael Hashizume (Jira)

unread,
Feb 7, 2023, 4:38:02 PM2/7/23
to puppe...@googlegroups.com

Henrik Lindberg (Jira)

unread,
Feb 11, 2023, 4:37:03 PM2/11/23
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-11726
 
Re: Allow Puppet function calls from hiera data

This was something I really wanted to address but did not have a good solution for at the time. The main issue was that the hiera specified/implemented interpolation syntax/logic blocks innovation in this area - we were not able to find syntax that would be 100% backwards compatible. I always thought it was a shame that hiera interpolation is different in syntax and features compared to puppet string interpolation. I wrote the puppet language hiera backend in my tahu module as a proof of concept of what it would take to support this if done in the most powerful way - i.e. data is puppet language. I had ideas of incorporating that implementation into the existing hiera json/yaml backends by having backend options to toggle the interpolation behavior, either for an entry in hiera.yaml, or as a lookup_option per key. That would enable people to opt in where they need this feature. I.e. that flag would control how the content of a hiera {{%{ }}} part would be interpreted, as current hiera interpolation or as if it was a {{${ } }}part in a puppet language string.

 

Just my 2c...

Josh Cooper (Jira)

unread,
Feb 14, 2023, 4:48:03 PM2/14/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
In combination with stdlib::manage I want to be able to use Puppet functions from hiera data.

 

e.g.

 
{code:java}
stlib stdlib ::manage:: create_reosurces create_resources :
  file:
    '/etc/motd':
    ensure: file
    content: %{epp('profile/motd.epp')}
{code}
 

Actual result:
{noformat}
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Unable to parse (/etc/puppetlabs/code/environments/production/data/common.yaml): found character '%' that cannot start any token. (Do not use % for indentation) while scanning for the next token at line 72 column 16{noformat}
Desired result: The content is rendered from the template.

Josh Cooper (Jira)

unread,
Feb 14, 2023, 4:50:05 PM2/14/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Epic Link: PUP-11659
Reply all
Reply to author
Forward
0 new messages