On 12/11/2012 05:18 PM, MaTi Villagra wrote:
Hello I'm trying to push PS1 variable at .bashrc file

     exec { 'GIT PS1 Variable':
     cwd => '/home/developer/.bashrc',
     command => '/bin/echo "PS1='[\u@\h \W\$(__git_ps1  " \""
(%s)"\"")]\$ ' " >> /home/developer/.bashrc',
     user => developer,
     group => developer,
    }

But client side  I get

Dec 11 10:15:43 glb7240 puppet-agent[19762]: Could not retrieve catalog
from remote server: Error 400 on SERVER: Syntax error at '['; expected
']' at /etc/puppet/modules/defaults/manifests/bash-extras.pp:53

If I copy command it work perfectly. Any toughs  ?

First of all, cwd points to a file in your case and not to a directory.

Next, you should escape quote characters, so if u use singlequote (') in a puppet, which you should, then any occurrence of singlequote inside your intended string should be escaped. So, your resource should look like this:

exec { 'GIT PS1 Variable':
  cwd => '/home/developer',
command => '/bin/echo "PS1=\'[\u@\h \W\$(__git_ps1 " \"" (%s)"\"")]\$ \' " >> /home/developer/.bashrc',
  user => developer,
  group => developer,
}


Note the escape (\) character in:

"PS1=\'

and:

$ \' " >>



--
Jakov Sosic
www.srce.unizg.hr

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to