Puppet DSL String concatenation

0 votes
is there a string concatenation operator in the Puppet DSL? It appears that there is currently no such thing. But how do i achieve the objective of string concatenation in puppet? How do I create a string composed of multiple string values?
Aug 8, 2019 in Puppet by Henry
279 views

1 answer to this question.

0 votes

Method 1: One way is Keyword variable interpolation:

$value = "${one}${two}"

Source: http://docs.puppetlabs.com/puppet/4.3/reference/lang_variables.html#interpolation

Note that although it might work without the curly braces, you should always use them.

Method 2: Another option is using Puppets sprintf() function, which functions identically to the ruby function behind it. 

An example:

$x = sprintf('hello user %s', 'CoolUser')

It is verified to work perfectly with puppet. This approach can also help you concatenate the output of functions.

answered Aug 8, 2019 by Sirajul
• 59,070 points

Related Questions In Puppet

0 votes
1 answer
0 votes
1 answer

Puppet: String Interpolation in puppet

Try this for Keyword variable interpolation: $value = ...READ MORE

answered Aug 29, 2019 in Puppet by Sirajul
• 59,070 points
270 views
0 votes
1 answer

How to check the syntax of Puppet DSL code?

Hi@akhtar, At the lowest level of checking, you ...READ MORE

answered Dec 31, 2020 in Puppet by MD
• 95,220 points
79 views
+5 votes
2 answers

How To Deploy Windows Server Using Puppet?

Deploying windows server through Puppet is similar ...READ MORE

answered Mar 26, 2018 in Puppet by shubham
• 7,320 points
818 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,138 views
+2 votes
1 answer
0 votes
1 answer

Puppet+kubernetes: How do I describe a Kubernetes Pod in Puppet DSL?

The Puppet Kubernetes module currently assumes you ...READ MORE

answered Aug 21, 2019 in Puppet by Sirajul
• 59,070 points
145 views
0 votes
1 answer

Puppet and Jenkins: How can I manage Jenkins job using Puppet DSL?

Managing Jenkins jobs: Build jobs can be managed ...READ MORE

answered Aug 28, 2019 in Puppet by Sirajul
• 59,070 points
178 views