How do you concatenate strings in a Puppet .pp file?

后端 未结 6 1115
醉话见心
醉话见心 2021-02-03 17:27

Here is my naive approach:

# puppet/init.pp
$x = \'hello \' + 
     \'goodbye\'

This does not work. How does one concatenate strings i

6条回答
  •  误落风尘
    2021-02-03 18:02

    I use the construct where I put the values into an array an then 'join' them. In this example my input is an array and after those have been joined with the ':2181,' the resulting value is again put into an array that is joined with an empty string as separator.

    $zookeeperservers = [ 'node1.example.com', 'node2.example.com', 'node3.example.com' ]
    $mesosZK = join([ "zk://" , join($zookeeperservers,':2181,') ,":2181/mesos" ],'')
    

    resulting value of $mesosZK

    zk://node1.example.com:2181,node2.example.com:2181,node3.example.com:2181/mesos
    

提交回复
热议问题