Skip to content

Instantly share code, notes, and snippets.

@phrawzty
Created June 20, 2011 10:36
Show Gist options
  • Save phrawzty/1035419 to your computer and use it in GitHub Desktop.
Save phrawzty/1035419 to your computer and use it in GitHub Desktop.
MC "timeout" not being respected ?
metadata :name => 'Foo',
:description => 'foo foo foo',
:author => '[email protected]',
:license => 'other',
:version => '0.1',
:url => 'none',
:timeout => 30
action 'go', :description => 'waits for X seconds' do
input :time,
:prompt => 'wait_for',
:description => 'wait for this many seconds',
:type => :integer,
:optional => true,
:maxlength => 3
end
module MCollective
module Agent
class Foo<RPC::Agent
metadata :name => 'Foo',
:description => 'foo foo foo',
:author => '[email protected]',
:license => 'other',
:version => '0.1',
:url => 'none',
:timeout => 30
action 'go' do
go(request[:x])
end
private
def go(wait)
reply[:exitcode] = run("/tmp/wait.sh #{wait}", :stdout => :out, :stderr => :err, :chomp => true)
end
end
end
end
$ mc-rpc foo go x=1 -v --wi <target>
Determining the amount of hosts matching filter for 2 seconds .... 1
* [ ============================================================> ] 1 / 1
<target> : OK
{:err=>"", :exitcode=>0, :out=>"sleeping for 1 seconds\nand done"}
---- foo#go call stats ----
Nodes: 1 / 1
Pass / Fail: 1 / 0
Start Time: Mon Jun 20 12:35:19 +0200 2011
Discovery Time: 2001.85ms
Agent Time: 1093.33ms
Total Time: 3095.18ms
$ mc-rpc foo go x=6 -v --wi <target>
Determining the amount of hosts matching filter for 2 seconds .... 1
---- foo#go call stats ----
Nodes: 1 / 0
Pass / Fail: 0 / 0
Start Time: Mon Jun 20 12:35:25 +0200 2011
Discovery Time: 2002.52ms
Agent Time: 5001.74ms
Total Time: 7004.26ms
No response from:
<target>
$
#!/bin/bash
echo "sleeping for $1 seconds"
sleep $1
echo 'and done'
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment