The command should be in single quotes, try
exec { "ls":
command => 'test $(grep -c aa /tmp/aao) -gt 0',
returns => 1,
path => "/usr/bin:/usr/sbin:/bin",
}
Note also that you were missing a comma after the command property, that
must be present.
Jeff
On 12/18/2013 04:40 AM, shlo.af...@gmail.com wrote:
I did not understand where exactly put the test line. I tried:
exec { "ls":
command => test $(grep -c aa /tmp/aao) -gt 0
returns => 1,
path => "/usr/bin:/usr/sbin:/bin",
}
I got the error:
Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not match $(grep at /etc/puppet/.../init.pp:4 on node
agent....
I need the test to run each time Puppet run.
Thank you for your quick response.
On Wednesday, December 18, 2013 11:11:00 AM UTC+2, Stephen Gran wrote:
On 12/18/2013 08:41 AM, shlo....@gmail.com <javascript:> wrote:
>
> Hi,
>
> I want to run a command something like:
> /cat /tmp/aao | grep aa | wc -l/
> Check the output of that command, if the output is '0', I want
to get a
> failure from puppet.
> I tried to use 'exec' with 'returns' but it's seem that
'returns' take
> the return code of the command and not the output of the command.
> How can I do it right?
test $(grep -c aa /tmp/aao) -gt 0
Cheers,
--
Stephen Gran
Senior Systems Integrator - theguardian.com <http://theguardian.com>
Please consider the environment before printing this email.
------------------------------------------------------------------
Visit theguardian.com <http://theguardian.com>
On your mobile, download the Guardian iPhone app
theguardian.com/iphone <http://theguardian.com/iphone> and our
iPad edition theguardian.com/iPad <http://theguardian.com/iPad>
Save up to 33% by subscribing to the Guardian and Observer -
choose the papers you want and get full digital access.
Visit subscribe.theguardian.com <http://subscribe.theguardian.com>
This e-mail and all attachments are confidential and may also
be privileged. If you are not the named recipient, please notify
the sender and delete the e-mail and all attachments immediately.
Do not disclose the contents to another person. You may not use
the information for any purpose, or store, or copy, it in any way.
Guardian News & Media Limited is not liable for any computer
viruses or other material transmitted with or as part of this
e-mail. You should employ virus checking software.
Guardian News & Media Limited
A member of Guardian Media Group plc
Registered Office
PO Box 68164
Kings Place
90 York Way
London
N1P 2AP
Registered in England Number 908396
--------------------------------------------------------------------------
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/d0a7ec9b-82a7-4f1d-800c-29ddd53cc480%40googlegroups.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/52B1B810.5090906%40bericotechnologies.com.
For more options, visit https://groups.google.com/groups/opt_out.