Ask Your Question
0

file_line match malfunction

asked 2017-09-07 01:41:56 -0500

vjsaisha gravatar image

While checking the function of file_line as per the puppet document example is not working it's appending not replacing. Code as follows

file_line { 'bashrc_proxy':
  ensure            => present,
  path              => '/tmp/file_line',
  line              => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
  match             => '^export\=',
  replace           => true,
}
edit retag flag offensive close merge delete

Comments

1

Please check out, whether a question's already been asked, before posting a new one. This one appears to have already been noted: https://ask.puppet.com/question/31855/

Kai Burghardt gravatar imageKai Burghardt ( 2017-09-07 18:15:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-09-07 12:22:03 -0500

notwithoutcid gravatar image

Is this the doc you are looking at https://forge.puppet.com/puppetlabs/stdlib ?

Without seeing the contents of /tmp/file_line I can't say for sure, but I doubt that that the match resource will work. The stdlib docs say to use

match  => '^export\ HTTP_PROXY\=',

The "^" indicates the beginning of the line, so you'll need to match exactly or use wildcards such as

match => '^export.*\=',

Just play with it until you have the right balance of always finding the line without false positives or multiple lines. good luck.

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: 2017-09-07 01:41:56 -0500

Seen: 47 times

Last updated: Sep 07