slipstream / SlipStreamClient

SlipStream Python client
Apache License 2.0
1 stars 4 forks source link

ss-get-all CLI #328

Closed konstan closed 7 years ago

konstan commented 7 years ago

Useful when checking component's readiness. E.g.:

ss-get-all my_cluster ready --value true --timeout 600
$ ss-get-all -h
Usage: usage: ss-get-all.py [options] <component> <key>

<component> Name of the component.
<key>       Key (non-qualified runtime parameter) to retrieve the value from

Options:
  -h, --help         show this help message and exit
  -v, --verbose      verbose level. Add more to get more details.
  --timeout=SECONDS  timeout in seconds for blocking call
  --ignore-abort     by default, if the run abort flag is set, any
                     call will return with an error. With this option values
                     can be queried even if the abort flag is raised
  --noblock          return immediately even if the parameter has no value
  --value=VALUE      expected value; check if all components set the parameter
                     to the expected value; exits with 1 if parameter not
                     equal to the value on any of the of the components
$
$ ss-get testclient.1:hostname
foo
$ ss-get testclient.2:hostname
foo
$ ss-get testclient.3:hostname
foo
$ ./ss-get-all.py testclient hostname
testclient.1:hostname foo
testclient.2:hostname foo
testclient.3:hostname foo
$ # Set to unexpected value and call with --value
$ ss-set testclient.2:hostname abc
$ ./ss-get-all.py testclient hostname --value foo
RTP value on some components not equal to the expected value: foo
testclient.1:hostname foo
testclient.2:hostname abc
testclient.3:hostname foo
$ echo $?
1
$ # Unset parameter and call with --value and --timeout
$ ss-set testclient.2:hostname ''
$ ./ss-get-all.py testclient hostname --value foo --timeout 5
Waiting for testclient.2:hostname
Exceeded timeout limit of 5 waiting for key 'testclient.2:hostname' to be set
RTP value on some components not equal to the expected value: foo
testclient.1:hostname foo
testclient.2:hostname
testclient.3:hostname foo
$ echo $?
1
$

Connected to #325