Clush¶
The clush
pack is a low-level pack that provide an action for running a command on some nodes.
clush.remote
: Action to execute arbitrary command remotely using clush
Actions¶
clush.remote¶
Requires 2 parameters: cmd
and nodeset
or nodelist
. Respectively representing the command to launch and the hosts (NodeSet format for nodeset
, a list for nodelist
) where to launch it.
Optionnaly, a cwd
can be provided to change the working directory where the command is launched and the timeout
parameter set the action-wide (StackStorm-related) timeout.
The output result of this action contains 4 parts:
retcode
: hash where keys are the return code (string) of the command and values an array containing the hosts where it happened.status
: hash where key is eitherERROR
orOK
and values an array containing the hosts where it happened. A non-zero return code is used as the criteria.stderr
: hash where key is a single host and value the standard error contentstdout
: hash where key is a single host and value the standard output content
parameters:
cmd: uname -r
nodeset: irene[4000-4008]
result:
retcode:
'0':
- irene4000
- irene4001
- irene4002
- irene4003
- irene4004
- irene4005
- irene4006
- irene4007
- irene4008
status:
ERROR: []
OK:
- irene4000
- irene4001
- irene4002
- irene4003
- irene4004
- irene4005
- irene4006
- irene4007
- irene4008
stderr:
irene4000: ''
irene4001: ''
irene4002: ''
irene4003: ''
irene4004: ''
irene4005: ''
irene4006: ''
irene4007: ''
irene4008: ''
stdout:
irene4000: 3.10.0-957.41.1.el7.x86_64
irene4001: 3.10.0-957.41.1.el7.x86_64
irene4002: 3.10.0-957.41.1.el7.x86_64
irene4003: 3.10.0-957.41.1.el7.x86_64
irene4004: 3.10.0-957.41.1.el7.x86_64
irene4005: 3.10.0-957.41.1.el7.x86_64
irene4006: 3.10.0-957.41.1.el7.x86_64
irene4007: 3.10.0-957.41.1.el7.x86_64
irene4008: 4.18.0-147.5.1.el8_1.x86_64
clush.nodeset_to_array¶
Action that transform given nodeset (nodeset
parameter) into an array of hosts.
# st2 run clush.nodeset_to_array nodeset=a[1,2]
id: 5ea2a7db049f2e425784c979
status: succeeded
parameters:
nodeset: a[1,2]
result:
exit_code: 0
result:
hosts:
- a1
- a2
stderr: ''
stdout: ''
clush.array_to_nodeset¶
Action that transform given host array (hosts
parameter) into a nodeset
# st2 run clush.array_to_nodeset hosts=a1,a2
id: 5ea2a7c2049f2e425784c976
status: succeeded
parameters:
hosts:
- a1
- a2
result:
exit_code: 0
result:
nodeset: a[1-2]
stderr: ''
stdout: ''
clush.wait_for_port¶
Action that waits for a particular port to be open on the given nodes.
Requires the nodelist
and port
to define what to probe.
Optionnaly, you can use the timeout
, delay
, connect_timeout
and retries
to change this action behaviour.
# st2 run clush.wait_for_port hosts=irene[4000,4001] port=8080 retries=3 delay=1
id: 5ea7ccea049f2e2b3f868368
status: succeeded
parameters:
delay: 1
nodelist:
- irene4000
- irene4001
port: 8080
retries: 3
result:
retcode:
'0':
- irene4000
'1':
- irene4001
status:
ERROR:
- irene4001
OK:
- irene4000
stderr:
irene4000: 'Ncat: Connection timed out.'
irene4001: "Ncat: Connection timed out.
Ncat: Connection timed out.
Ncat: Connection timed out."
stdout:
irene4000: ''
irene4001: ''