Ask Your Question
1

difference between quotes around a string

asked 2013-12-19 14:38:34 -0500

Thynan gravatar image

updated 2013-12-19 16:36:29 -0500

Hi!

This may be a very simple question, but i don't completely get the way puppet handles " and ' differently. For example, if i write

notify{"The content of the variable is:  ${some_variable}": }

in my manifest, i get the actual content of $some_variable on my console during a puppet run. However if i write

notify{ 'The content of the variable is:  ${some_variable}': } #(notice the different quote)

I only get the actual text "The content of the variable is: ${some_variable}" on my console.

Why is that, and how does puppet treat " differently from ' ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-12-19 14:55:32 -0500

brenix gravatar image

This is correct, the main difference is that having double quotes allows you to interpolate ${variables} .

More information on how puppet treats this is covered in the data types documentation: http://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html

Hopefully that helps

edit flag offensive delete link more

Comments

I've not seen this in the docs, but I have been told by Puppet Labs PSEs that string interpolation can cost a small amount of resources, so single quotes ...(more)

jarrettone gravatar imagejarrettone ( 2013-12-20 11:58:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-12-19 14:38:34 -0500

Seen: 1,567 times

Last updated: Dec 19 '13