not able to comment line using file_line resource

227 views
Skip to first unread message

Supriya Uppalapati

unread,
Jul 24, 2014, 11:17:41 AM7/24/14
to puppet...@googlegroups.com
Hi,
 
I did like this using file_line resource
file_line { 'replace a line to /home/infauser/.bash_profile':
      path => '/home/infauser/.bash_profile',
      line => 'export INFA_CODEPAGENAME=UTF-8',
      #match => '^# export INFA_CODEPAGENAME=UTF-8.*',
 
But it is giving me an error:
 
Error: Failed to apply catalog: Validation of File_line[replace a line to /home/infauser/.bash_profile] failed: When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter at /etc/puppetlabs/puppet/environments/development/modules/powercenter/manifests/init.pp:75
Wrapped exception:
When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter
 
 
It is not adding # to the starting of the line.
 
Please help me

Joachim Schrod

unread,
Jul 24, 2014, 9:26:55 PM7/24/14
to puppet...@googlegroups.com
On 07/24/14 17:17, Supriya Uppalapati wrote:
>
> I did like this using file_line resource
> file_line { 'replace a line to /home/infauser/.bash_profile':
> path => '/home/infauser/.bash_profile',
> line => 'export INFA_CODEPAGENAME=UTF-8',
> #match => '^# export INFA_CODEPAGENAME=UTF-8.*',*

Your "match" regexp must match the line *both* before *and* after
the change.

I.e.,

match => 'export INFA_CODEPAGENAME=UTF-8',

will probably work. If .bash_profile doesn't have that line yet, it
is added.

HTH,
Joachim

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsc...@acm.org

Reply all
Reply to author
Forward
0 new messages