using file_line with match

7,271 views
Skip to first unread message

Stefan Wiederoder

unread,
Jan 18, 2013, 3:07:44 AM1/18/13
to puppet...@googlegroups.com
I´m using stdlib 3.2 on my 3.0.1 master/agent

my goal is to replace a line within a configuration file to add one more server like this:
file_line { "xxx": line => "ALLOWHOST server1|server2", path => "/tmp/sw", match => "^ALLOWHOST$", ensure => present }

I´ve tried to use match to ensure that the existing line is changed, but I´m getting this error message:
Error: Failed to apply catalog: When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter

how can I solve this?

thanks
,
Stefan

GRANIER Bernard (MORPHO)

unread,
Jan 18, 2013, 4:13:55 AM1/18/13
to puppet...@googlegroups.com

Hi,

 

Since no one answered to my previous post, I  suppose that it is not possible to do something like that :

 

$machines_DB="\’computerName\'"

 

$machines_serverWeb="\’computerName2\'"

 

node $machines_DB {

  include deploymenDB

}

 

node $machines_serverWeb {

   include deploymentServerWeb

}

 

 

 

#
" This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, you are notified that any dissemination, copying of this e-mail and any attachments thereto or use of their contents by any means whatsoever is strictly prohibited. If you have received this e-mail in error, please advise the sender immediately and delete this e-mail and all attached documents from your computer system."
#

Ellison Marks

unread,
Jan 18, 2013, 12:50:36 PM1/18/13
to puppet...@googlegroups.com
@Stephan, as it stands, the match parameter must be able to regex match the line parameter. I think this is so you can only replace similar lines. You could drop the $ at the end and it would probably work.

@bernard, I think something is wrong with the client you use to access the group. Your replies are getting posted to random threads.

Stefan Wiederoder

unread,
Jan 21, 2013, 8:16:42 AM1/21/13
to puppet...@googlegroups.com
Hello Ellison,

yes, you´re right, now it´s working:

file_line { "xxx": line => "ALLOWHOST server1|server2", path => "/tmp/sw", match => "ALLOWHOST.*$", ensure => present }


thanks
,
Stefan
Reply all
Reply to author
Forward
0 new messages