inlined-epp with hash

91 views
Skip to first unread message

Andreas Dvorak

unread,
Sep 10, 2020, 2:10:26 AM9/10/20
to Puppet Users
Hi,

I have this structure in hiera and want to use it in a inlined-epp file

cms::params::database_conf:
'oracle_cms_dev':
   oracle_cms_jdbc_schema: 'CMS_DEV'
   oracle_cms_jdbc_user: 'CMS_DEV'
   oracle_cms_jdbc_driver: 'oracle.jdbc.OracleDriver'
   oracle_cms_jdbc_url: 'jdbc:oracle:thin:....)'
'oracle_cms_dev2':
   oracle_cms_jdbc_schema: 'CMS_DEV2'
   oracle_cms_jdbc_user: 'CMS_DEV2'
   oracle_cms_jdbc_driver: 'oracle.jdbc.OracleDriver'
   oracle_cms_jdbc_url: 'jdbc:oracle:thin:


code in the class
$vault_vars_jdbc = {
'database_conf' => $cms::params::database_conf,
}


epp file
<%- |
  Hash database_conf,
| -%>


But I get the error:
Error: Failed to apply catalog: inline_epp(): Invalid EPP: Syntax error at 'database_conf' (file: inlined-epp-text, line: 2, column: 11)

So "Hash" does not work. Can somebody please help me?

Regards,
Andreas

Helmut Schneider

unread,
Sep 10, 2020, 6:29:18 AM9/10/20
to puppet...@googlegroups.com
Am 10.09.2020 um 08:10 schrieb Andreas Dvorak:

> epp file
> <%- |
> Hash database_conf,
> | -%>

Hash $databse_conf

Andreas Dvorak

unread,
Sep 10, 2020, 6:47:01 AM9/10/20
to Puppet Users
I found a solution:
<%- | String $database_schemes,
     Hash[String, Hash[String, String]] $database_conf,
| -%>

DATABASES=<%= $database_schemes %>
<% $database_conf.keys.sort.each |$key| { -%>
##################################################
<%= $key %>.jdbc.DRIVER=<%= $database_conf[$key]['oracle_cms_jdbc_driver'] %>
<% } -%>

Reply all
Reply to author
Forward
0 new messages