How to convert array to comma separated string in Puppet 2.7

17,133

Function join from puppetlabs/stdlib:

join($hosts_fqdn,',')
Share:
17,133

Related videos on Youtube

jaksky
Author by

jaksky

I really love to build "smart" products with elegance and simplicity by using modern techniques and technologies like BigData, Machine Learning and Reactive systems architecture. The build part is just half of the story on the way to build a great product. Every technical challenge can be solved by multiple ways to select the one you need to understand of the second half of the product cycle. My core believes: Small cross-functional teams Diversity in the team Team’s end to end ownership Iterative development, testing hypothesis A high degree of automation Love problem, not the solution Data-driven decision A bad system will beat a good person every time Everybody is great at something, the role of the leader is to discover it, find the right place and support it A team is more powerful than individuals Focus on business outcomes not just outputs like features and dates. It is hard to make things simple Value decision by the cost of reverting it back

Updated on October 23, 2022

Comments

  • jaksky
    jaksky over 1 year

    I am using Puppet 2.7 and I need to convert an array to comma separated list.

    $hosts_fqdn= ['host1','host2','host3']
    

    And I need to convert it to desired result: 'host1,host2,host3'

    I guess that Puppet 3.2 offers lambda expression - reduce. But unfortunately that is not possible with 2.7.