Ask Your Question
0

update value on class

asked 2013-09-23 08:25:18 -0500

shyp gravatar image

updated 2013-09-24 01:28:39 -0500

I have class which get parameters , is there any option running regular expression on a which comes as an input

for example I am getting as an input "a,b" and I want to change it to a_b

this is the class :

define fileiel::upstartinitfile($parameter) {
  file { "/etc/init/$parameter":
    content => template('file/file.conf.erb'),
    mode    => '0775',
 }
}

I would like to change the $parameter value.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-09-23 09:56:51 -0500

doc75 gravatar image

updated 2013-09-24 02:46:02 -0500

Hello,

Did you have look at this part of the official documentation ?

As far as I understand your question, it should match your need.

edit flag offensive delete link more

Comments

Thanks , I missed all the goodies here "http://docs.puppetlabs.com/references/latest/function.html#regsubst" thanks for the help guys !

shyp gravatar imageshyp ( 2013-09-24 01:30:35 -0500 )edit

Do not forget to flag as correct the answer that match your request (for future user reference).

doc75 gravatar imagedoc75 ( 2013-09-24 02:47:45 -0500 )edit
1

answered 2013-09-23 10:04:01 -0500

golja gravatar image

You could use regsubst function

Example: regsubst("a,b", ',','_') output would be a_b.

edit flag offensive delete link more

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-09-23 08:25:18 -0500

Seen: 59 times

Last updated: Sep 24 '13