How to convert array to comma separated string in Puppet 2.7

妖精的绣舞 提交于 2019-12-05 15:56:01

问题


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.


回答1:


Function join from puppetlabs/stdlib:

join($hosts_fqdn,",")


来源:https://stackoverflow.com/questions/18526456/how-to-convert-array-to-comma-separated-string-in-puppet-2-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!