如何在 Puppet 2.7 中将数组转换为逗号分隔的字符串 [英] How to convert array to comma separated string in Puppet 2.7

查看:28
本文介绍了如何在 Puppet 2.7 中将数组转换为逗号分隔的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Puppet 2.7,我需要将数组转换为逗号分隔的列表.

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

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

我需要将其转换为所需的结果:'host1,host2,host3'

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

我猜 Puppet 3.2 提供了 lambda 表达式 - reduce.但不幸的是,这在 2.7 中是不可能的.

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

推荐答案

Function join from 木偶实验室/标准库:

Function join from puppetlabs/stdlib:

join($hosts_fqdn,",")

这篇关于如何在 Puppet 2.7 中将数组转换为逗号分隔的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆