Hi!

Just add backslash before $:
>> exec { "file_system_cleanup":
>>                 command => "touch /root/file_system_cleanup.log",
>>                 path    => '/bin/:/sbin/:/usr/bin/:/usr/sbin',
>>                 onlyif  => "test `df -h / | tail -1 | awk '{print \$5}' | 
>> sed 's/%//g'` -gt 20",
>          }


> On Mar 1, 2016, at 02:57, warron.french <[email protected]> wrote:
> 
> How does one escape something like she'll values inside awk inside ruby code?
> 
> On Feb 29, 2016 3:40 PM, "Thomas Müller" <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> 
> Am Montag, 29. Februar 2016 20:20:25 UTC+1 schrieb [email protected] 
> <mailto:[email protected]>:
> Hi All,
> 
> I following code is not working. Not sure why. 
> 
> exec { "file_system_cleanup":
>                 command => "touch /root/file_system_cleanup.log",
>                 path    => '/bin/:/sbin/:/usr/bin/:/usr/sbin',
>                 onlyif  => "test `df -h / | tail -1 | awk '{print $5}' | sed 
> 's/%//g'` -gt 20",
>          }
> 
> you need to escape $ signs or puppet will replace $5 with probably an empty 
> string.
> 
> https://docs.puppetlabs.com/puppet/latest/reference/lang_data_string.html#escape-sequences
>  
> <https://docs.puppetlabs.com/puppet/latest/reference/lang_data_string.html#escape-sequences>
> 
> - Thomas 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/020c7283-a183-4d37-9460-209318875dc2%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/puppet-users/020c7283-a183-4d37-9460-209318875dc2%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/CAJdJdQ%3D6CU562y-xr3pJ%3Dp8zj1FsER8YaruNcP-FCgZHCTCnsA%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/puppet-users/CAJdJdQ%3D6CU562y-xr3pJ%3Dp8zj1FsER8YaruNcP-FCgZHCTCnsA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/42E38378-3223-4B2E-A594-6D5407E5BC0C%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to