Minor bug fixes and add missing waypoints logging for compute mgmt

master
Sergey Shubin svs1370 4 years ago
parent fdbcdbe208
commit 20190532b5

@ -829,7 +829,7 @@ def main():
if subj.comp_info['status'] in ("DISABLED", "MIGRATING", "DELETING", "DESTROYING", "ERROR", "REDEPLOYING"): if subj.comp_info['status'] in ("DISABLED", "MIGRATING", "DELETING", "DESTROYING", "ERROR", "REDEPLOYING"):
# cannot do anything on the existing Compute in the listed states # cannot do anything on the existing Compute in the listed states
subj.error() # was subj.nop() subj.error() # was subj.nop()
elif subj.comp_info['status'] == "ENABLED": elif subj.comp_info['status'] in ("ENABLED", "DISABLED"):
if amodule.params['state'] == 'absent': if amodule.params['state'] == 'absent':
subj.destroy() subj.destroy()
elif amodule.params['state'] in ('present', 'paused', 'poweredon', 'poweredoff', 'halted'): elif amodule.params['state'] in ('present', 'paused', 'poweredon', 'poweredoff', 'halted'):
@ -843,8 +843,9 @@ def main():
_, subj.comp_info, _ = subj.compute_find(comp_id=subj.comp_id) _, subj.comp_info, _ = subj.compute_find(comp_id=subj.comp_id)
subj.modify() subj.modify()
elif amodule.params['state'] == 'absent': elif amodule.params['state'] == 'absent':
subj.nop() # subj.nop()
subj.comp_should_exist = False # subj.comp_should_exist = False
subj.destroy()
elif amodule.params['state'] in ('paused', 'poweredoff', 'halted'): elif amodule.params['state'] in ('paused', 'poweredoff', 'halted'):
subj.error() subj.error()
elif subj.comp_info['status'] == "DESTROYED": elif subj.comp_info['status'] == "DESTROYED":

@ -625,6 +625,8 @@ class DecortController(object):
@return: (int) ret_rg_id - validated ID of the RG, where this Compute instance was found. @return: (int) ret_rg_id - validated ID of the RG, where this Compute instance was found.
""" """
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "compute_find")
COMP_INVALID_STATES = ["DESTROYED", "DELETED", "ERROR", "DESTROYING"] COMP_INVALID_STATES = ["DESTROYED", "DELETED", "ERROR", "DESTROYING"]
ret_comp_id = 0 ret_comp_id = 0
@ -1251,7 +1253,7 @@ class DecortController(object):
if self.amodule.check_mode: if self.amodule.check_mode:
self.result['failed'] = False self.result['failed'] = False
self.result['msg'] = "rg_delete() in check mode: delete RG ID {} was requested.".format(arg_rg_id) self.result['msg'] = "rg_delete() in check mode: delete RG ID {} was requested.".format(rg_id)
return return
# #

Loading…
Cancel
Save