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
2,355 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,230 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,230 points
1,049 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,460 points
826 views
+5 votes
2 answers

How To Deploy Windows Server Using Puppet?

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

answered Mar 27, 2018 in Puppet by shubham
• 7,340 points
1,876 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 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,230 points
961 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,230 points
766 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP