Ensure CLI exit 1 with negative result
When the deploy precheck condition is not met, ensure CLI exit code 1. Closes-bug: 2065193 TCs: Passed: verify CLI exit code 1 when precheck condition not met for both software deploy precheck and software deploy start. Passed: verify CLI exit code 0 when deploy precheck pass Passed: verify CLI exit code 0 when deploy start pass Change-Id: I0f73497140fcc82e3c8f583e9b421d2ff3e4db30 Signed-off-by: Bin Qian <bin.qian@windriver.com>
This commit is contained in:
parent
eefb215a96
commit
0105772078
|
@ -149,6 +149,7 @@ def _extract_error_json(body, resp):
|
|||
except ValueError:
|
||||
return {}
|
||||
|
||||
|
||||
class Response(object):
|
||||
"""SessionClient and HttpClient do not return the same
|
||||
response object. This calss is to create a common response
|
||||
|
|
|
@ -40,6 +40,7 @@ def do_show(cc, args):
|
|||
|
||||
return rc
|
||||
|
||||
|
||||
def do_host_list(cc, args):
|
||||
"""List of hosts for software deployment """
|
||||
resp, data = cc.deploy.host_list()
|
||||
|
@ -78,9 +79,14 @@ def do_precheck(cc, args):
|
|||
if args.debug:
|
||||
utils.print_result_debug(resp, data)
|
||||
|
||||
utils.display_info(resp)
|
||||
rc = utils.check_rc(resp, data)
|
||||
if rc == 0:
|
||||
if data["system_healthy"] is False:
|
||||
print("System is unhealthy for deploy")
|
||||
rc = 1
|
||||
|
||||
return utils.check_rc(resp, data)
|
||||
utils.display_info(resp)
|
||||
return rc
|
||||
|
||||
|
||||
@utils.arg('deployment',
|
||||
|
@ -96,9 +102,14 @@ def do_start(cc, args):
|
|||
if args.debug:
|
||||
utils.print_result_debug(resp, data)
|
||||
|
||||
utils.display_info(resp)
|
||||
rc = utils.check_rc(resp, data)
|
||||
if rc == 0:
|
||||
if "system_healthy" in data and data["system_healthy"] is False:
|
||||
print("System is unhealthy for deploy")
|
||||
rc = 1
|
||||
|
||||
return utils.check_rc(resp, data)
|
||||
utils.display_info(resp)
|
||||
return rc
|
||||
|
||||
|
||||
@utils.arg('host',
|
||||
|
|
Loading…
Reference in New Issue