Hi,

Lookup always returns strings.
You can use alias to retrieve the original value data type.

https://www.puppet.com/docs/puppet/7/hiera_merging.html#alias-function


Hth,
Martin

> On 13. Nov 2023, at 17:35, 'Tidhar Klein Orbach' via Puppet Users 
> <[email protected]> wrote:
> 
> Hi,
> 
> I have a hiera file that belongs to a server group. in that file there is a 
> key that expects a list of services.
> for example
> 
> job_name: "my-job"
> feature:
>   services:
>     - 'foo'
>     - 'bar'
>     - 'baz'
> 
> I want to be able to override the values, so I tried to define a default key 
> like:
> feature::services:: 'foo,bar,baz'
> 
> and then use it:
> job_name: "my-job"
> feature:
>    services: "%{lookup(feature::services)}"
> 
> I tried different value variations:
> feature::services:: foo,bar,baz 
> feature::services:: ['foo','bar','baz']  
> and  also using
> lookup_options:
>   feature::services:
>     convert_to:
>       - "Array"
>       - true
> 
> but it seems I can't convert the value to string array.
> 
> is it possible at all? if so, how can I do it?
> 
> thanks,
> Tidhar
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/d57c9444-8b38-4394-a03b-8442c42a3662n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/puppet-users/d57c9444-8b38-4394-a03b-8442c42a3662n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/430CE6A5-3999-4F2D-B302-6FA7E7C3D081%40gmail.com.

Reply via email to