Thanks a lot. i will try this on monday

2015-01-09 17:08 GMT+01:00 Stephen Marlow <tega...@gmail.com>:

> Yknow, completely disregard the above answer :p
>
> I was looking at stdlib and completely forgot about it before playing with
> inline templating.
>
> values and join in stdlib (https://github.com/puppetlabs/puppetlabs-stdlib)
> do what is needed here. Much less code smell that way :p
>
> On Fri, Jan 9, 2015 at 11:00 AM, Stephen Marlow <tega...@gmail.com> wrote:
>
>>  You could likely use iteration in the future parser or recursion to
>> build up the string, but what sits in my mind as the path of least
>> resistance is inline templating (c.f.
>> https://docs.puppetlabs.com/references/latest/function.html#inlinetemplate
>> ).
>>
>> I ran a quick test along these lines and it appeared to produce
>> appropriate output:
>>
>>   $search = {
>>     'cust0' => 'a41mgt.local all-for-one.local',
>>     'cust1' => 'A4T.local',
>>     'cust2' => 'a4y.remote',
>>   }
>>
>>   notify { "ILT Search: ${search}": }
>>
>>   $string = inline_template("<%= @search.values.join(' ') %>")
>>
>>   notify { "ILT String: ${string}": }
>>
>>   Notice: ILT Search: cust2a4y.remotecust1A4T.localcust0a41mgt.local
>> all-for-one.local
>>   Notice: ILT String: a4y.remote A4T.local a41mgt.local all-for-one.local
>>
>> This can definitely be improved upon, but it seems to do the trick.
>>
>>
>> On Fri, Jan 9, 2015 at 8:09 AM, Michael Wörz <michael.wo...@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> given the following datastructure i want to create a resolv.conf file
>>>
>>> dns:
>>>
>>>     nameservers:
>>>          '3': 10.200.1.230
>>>          '4': 10.200.1.231
>>>
>>>           .......
>>>     search:
>>>          cust0: a41mgt.local all-for-one.local
>>>          cust1: A4T.local
>>>
>>>          ......
>>>
>>>
>>> for the nameserver list it is easy to itaerate over the list calling a 
>>> defined type with a concat resource.
>>>
>>>
>>> the search list gives me  headache because i need to concatinate a string 
>>> from it.
>>>
>>>               a41mgt.local all-for-one.local A4T.local ...
>>>
>>>
>>> any ideas ?
>>>
>>>
>>> Thanks
>>>
>>>  --
>>> 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/2b2a3b34-1120-4d61-bfd6-caae6f6b0303%40googlegroups.com
>>> <https://groups.google.com/d/msgid/puppet-users/2b2a3b34-1120-4d61-bfd6-caae6f6b0303%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/HuptPetTEWw/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CALGSqjLBP8zvEwmTYD2Q4_J0FPhsdzAPFuoBc1xHL0KgHrEc7A%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CALGSqjLBP8zvEwmTYD2Q4_J0FPhsdzAPFuoBc1xHL0KgHrEc7A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGPb%2BVv2GAUMuhvEGzuKWBsM25JMqS1rr4DFKa%2BPPxGmenj15Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to