how to comment and uncomment lines in a file with puppet

1,145 views
Skip to first unread message

Supriya Uppalapati

unread,
Jul 23, 2014, 2:51:47 PM7/23/14
to puppe...@googlegroups.com
 
Other recipients:
Hi, I am trying the uncomment the lines in a file using augeas in puppet. But it is not commenting those lines. Here is the code which I have writen,   augeas { "bash_profile": context => "/home/infauser/.bash_profile", changes => [ "set #comment 'ex
Hi,
 
I am trying the uncomment the lines in a file using augeas in puppet. But it is not commenting those lines.
 
Here is the code which I have writen,
 
 
 
augeas { "bash_profile":
    context => "/home/infauser/.bash_profile",
    changes => [
     "set #comment 'export INFA_CODEPAGENAME=UTF-8'",
      "set #comment 'export INFA_HOME=/opt/apps/Informatica/9.5.1'",
       "set #comment 'export INFA_DOMAINS_FILE=/opt/apps/Informatica/9.5.1'",
],
But it is not commenting the lines.
 
 
Please help me

Spencer Krum

unread,
Jul 23, 2014, 5:05:33 PM7/23/14
to puppe...@googlegroups.com
You could likely use the file_line resource from the stdlib module to do this.


--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/07d6bab6-2143-4970-8d70-d67fde9e3bd7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Spencer Krum
(619)-980-7820

Supriya Uppalapati

unread,
Jul 24, 2014, 11:05:50 AM7/24/14
to puppe...@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

Felix Frank

unread,
Jul 24, 2014, 11:12:18 AM7/24/14
to puppe...@googlegroups.com
On 07/24/2014 05:05 PM, Supriya Uppalapati wrote:
> *Please help me*

While I'm not averse to that, I really think you should renew your
inquiry to the users list. Cross-posting is frowned upon, and this is
not a development issue.

Best,
Felix

Spencer Krum

unread,
Jul 24, 2014, 11:22:40 AM7/24/14
to puppe...@googlegroups.com

I agree with Felix.

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages