Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Puppet 2.7,我需要将数组转换为逗号分隔的列表。
$hosts_fqdn= ['host1','host2','host3']
我需要将其转换为所需的结果:'host1,host2,host3'
'host1,host2,host3'
我猜 Puppet 3.2 提供了 lambda 表达式 - reduce。但不幸的是,这在 2.7 中是不可能的。
reduce
joinpuppetlabs /stdlib中的函数:
join
join($hosts_fqdn,',')