Dan White
2013-Nov-12 20:35 UTC
[Puppet Users] Looking to repair "Unrecognised escape sequence" if possible
The recent traffic about " puppet master --compile ... " got me tinkering with it. I found a lot of old syntax in my templates, so I added "@" in front of all the current scope variables. That got rid of all the grumbles but one: Warning: Unrecognised escape sequence ''\1'' Warning: Unrecognised escape sequence ''\2'' from one of my manifests/init.pp files. The offending code can be found here: https://github.com/mcgonagle/puppet_nist/blob/master/nist/modules/umask/manifests/init.pp ...at the end of the file, define umask-replace($file) { exec { "umask_replace_${file}": command => "/bin/sed -i -r ''s/(umask)([ \t]*)[0-9]{3}/\1\2077/gi'' $file", onlyif => "/usr/bin/test `/bin/egrep -i ''(umask|UMASK)[[:space:]]*[0-9]{3}'' $file | /bin/egrep -v -i ''(umask|UMASK)[[:space:]]*077'' | /bin/wc -l` -ne 0"; } } Specifically, the "command" line Besides the fact that Unrecognized is misspelled (I copied/pasted out of the command output) , can anyone suggest a fix to remove the warnings ? “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/1225466231.4510845.1384288551237.JavaMail.root%40sz0126a.westchester.pa.mail.comcast.net. For more options, visit https://groups.google.com/groups/opt_out.
Josh Cooper
2013-Nov-13 05:16 UTC
Re: [Puppet Users] Looking to repair "Unrecognised escape sequence" if possible
On Tue, Nov 12, 2013 at 12:35 PM, Dan White <ygor@comcast.net> wrote:> The recent traffic about "puppet master --compile ..." got me tinkering > with it. > > I found a lot of old syntax in my templates, so I added "@" in front of > all the current scope variables. > That got rid of all the grumbles but one: > > Warning: Unrecognised escape sequence ''\1'' > Warning: Unrecognised escape sequence ''\2'' > > from one of my manifests/init.pp files. > > The offending code can be found here: > > > https://github.com/mcgonagle/puppet_nist/blob/master/nist/modules/umask/manifests/init.pp > > ...at the end of the file, > > define umask-replace($file) { > exec { > "umask_replace_${file}": > command => "/bin/sed -i -r ''s/(umask)([ > \t]*)[0-9]{3}/\1\2077/gi'' $file", > onlyif => "/usr/bin/test `/bin/egrep -i > ''(umask|UMASK)[[:space:]]*[0-9]{3}'' $file | /bin/egrep -v -i > ''(umask|UMASK)[[:space:]]*077'' | /bin/wc -l` -ne 0"; > } > } > > Specifically, the "command" line >Since you''re in a double quoted string, I assume the \1 and \2 backreferences need to be escaped: "/bin/sed -i -r ''s/(umask)([ \t]*)[0-9]{3}/\\1\\2077/gi'' $file", Josh -- Josh Cooper Developer, Puppet Labs -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CA%2Bu97ukxB7axgr4qEDj9o41qfFW34ovgyGjfK8tKXw2XecX20w%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Dan White
2013-Nov-13 14:28 UTC
Re: [Puppet Users] Looking to repair "Unrecognised escape sequence" if possible
That works. Many thanks. “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Josh Cooper" <josh@puppetlabs.com> To: puppet-users@googlegroups.com Sent: Wednesday, November 13, 2013 12:16:54 AM Subject: Re: [Puppet Users] Looking to repair "Unrecognised escape sequence" if possible On Tue, Nov 12, 2013 at 12:35 PM, Dan White < ygor@comcast.net > wrote: The recent traffic about " puppet master --compile ... " got me tinkering with it. I found a lot of old syntax in my templates, so I added "@" in front of all the current scope variables. That got rid of all the grumbles but one: Warning: Unrecognised escape sequence ''\1'' Warning: Unrecognised escape sequence ''\2'' from one of my manifests/init.pp files. The offending code can be found here: https://github.com/mcgonagle/puppet_nist/blob/master/nist/modules/umask/manifests/init.pp ...at the end of the file, define umask-replace($file) { exec { "umask_replace_${file}": command => "/bin/sed -i -r ''s/(umask)([ \t]*)[0-9]{3}/\1\2077/gi'' $file", onlyif => "/usr/bin/test `/bin/egrep -i ''(umask|UMASK)[[:space:]]*[0-9]{3}'' $file | /bin/egrep -v -i ''(umask|UMASK)[[:space:]]*077'' | /bin/wc -l` -ne 0"; } } Specifically, the "command" line Since you''re in a double quoted string, I assume the \1 and \2 backreferences need to be escaped: "/bin/sed -i -r ''s/(umask)([ \t]*)[0-9]{3}/\\1\\2077/gi'' $file", Josh -- Josh Cooper Developer, Puppet Labs -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CA%2Bu97ukxB7axgr4qEDj9o41qfFW34ovgyGjfK8tKXw2XecX20w%40mail.gmail.com . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/1411571707.4522620.1384352892082.JavaMail.root%40sz0126a.westchester.pa.mail.comcast.net. For more options, visit https://groups.google.com/groups/opt_out.