Christopher Wood wrote:

> On Fri, Jul 13, 2018 at 03:44:04PM +0000, Helmut Schneider wrote:
> > Christopher Wood wrote:
> > 
> > > Have you considered switching to an EPP template? You can limit
> > > the data passed in to only valid types (otherwise catalog
> > > compilation failure), it's quite useful.
> > 
> > Not yet. And I'm not sure if that will help. In my case there are
> > commands with and without parameters:
> > 
> > proto udp
> > dev tun
> > persist-tun
> > nobind
> 
> This still sounds like a data validation item quite doable with types.
> 
>
https://puppet.com/docs/puppet/5.5/lang_data_hash.html#the-hash-data-type
> 
> Hash[Enum['proto', 'dev'], String]
> Hash[Enum['proto', 'dev'], Variant[String, Undef]]
> 
> > So even if I pass only specific ones I still have to check if there
> > is a corresponding value for the key, otherwise
> > 
> > <%= key %> <%= value %>
> > 
> > will fail.
> 
> However the odd thing is that I am unable to reproduce what you are
> seeing with a plain undef in a very simple case. The undef is not
> stringified for me in puppet 5.4.0.

I changed the template to output value.class:

proto String
dev String
persist-tun Symbol
nobind Symbol
resolv-retry String
comp-lzo String
user String
group String
persist-key Symbol
cert String
key String
ca String
ns-cert-type String
verb String
log-append String
script-security String
plugin String
up String
down String

After further investigation this happend with deep_merge, because
without:

proto String
dev String
persist-tun NilClass
nobind NilClass
resolv-retry String
compress NilClass
comp-lzo String
user String
group String
persist-key NilClass
cert String
key String
ca String
ns-cert-type String
verb String
log-append String
script-security String
plugin NilClass
up String
down String

Without the deep_merge "if @openvpnConf[parameter]" works as expected.

helmut@h2786452:~$ puppet -V
4.10.12
helmut@h2786452:~$

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/xn0lcew6gvygcft005%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to