Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

file_line cannot delete lines by regexp?

$
0
0
There seems to be a misleading example in the stdlib documentation:
file_line { 'bashrc_proxy':
  ensure            => absent,
  path              => '/etc/bashrc',
  line              => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
  match             => '^export\ HTTP_PROXY\=',
  match_for_absence => true,
}
That snippet is supposed to find lines matching the regexp in "match" and replace them with the line in "line". However, it does not seem possible to delete a line by regular expression. I would like to process a zabbix_agentd.conf file and remove all lines starting with "UserParameter=mysql". The following snippet does not work:
  file_line { 'UserParameter=mysql':
    ensure => absent,
    path => '/etc/zabbix/zabbix_agentd.conf',
    line => '^UserParameter=mysql*',
  }
It seems from the source code snippet in http://superuser.com/questions/758915/puppet-file-line-remove-line-with-unknown-number-of-whitespaces that file_line does not delete lines unless they are an exact match. Perhaps the documentation could be updated to reflect this?

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>