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 ? Thanks. Appreciate. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/39ZJs1Y6t3kJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Dec 11, 2012 at 8:18 AM, MaTi Villagra <mativillagra@gmail.com> 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)"\"")]\$ ''The single quote following PS1= closes the string and the next character puppet parser sees is [ -- that''s what it seems to complain about. Thanks, Roman. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tuesday, December 11, 2012 4:18:45 PM UTC, 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, > } >You''re using single quotes for your Puppet string, but you''ve got single quotes in your bash PS1 line as well, so it''s confusing the Puppet parser. You''ve got a single quote after the " [ ", so Puppet is probably interpreting the rest of the line as an array, which is why the error is complaining about a missing " ] ". This function might help you get your escaping correct: http://docs.puppetlabs.com/references/latest/function.html#shellquote> > 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 ? > > > Thanks. Appreciate. > > > > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/6mmpf6xSkZgJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks for the help. PS1 is confusing puppet parser as Luke suggest, For example I was trying to start from a single command like command => "echo PS1=''a'' >> /home/developer/.bashrc" works perfectly. I also try to define as a line with no luck using http://projects.puppetlabs.com/projects/1/wiki/simple_text_patterns line { ''PS1 git variable'': file => ''/home/developer/.bashrc'', line => "PS1=''[\u@\h \W\$(__git_ps1 " \"" (%s)"\"")]\$ '' ", ensure => present, } Thanks! El martes, 11 de diciembre de 2012 10:18:45 UTC-6, MaTi Villagra escribió:> > 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 ? > > > Thanks. Appreciate. > > > > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/R3SRDy3dDZ0J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jakov, yours suggestion works perfectly. The only thing missing is that exec will write the only every time puppet parser goes by. So I will code a onlyif condition under that exec. I will poste the final result here. Thanks! El martes, 11 de diciembre de 2012 10:18:45 UTC-6, MaTi Villagra escribió:> > 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 ? > > > Thanks. Appreciate. > > > > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ZTs9_Jtk6JMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.