From 4311eee4353bca70356e27b31b966351248bbc6c Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Wed, 5 Jun 2024 13:14:27 +0300 Subject: [PATCH] Add LB starting logic in LB restoring logic and fix DecortController.lb_state method VALID_TARGET_STATES list --- library/decort_lb.py | 5 ++--- module_utils/decort_utils.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/library/decort_lb.py b/library/decort_lb.py index 5452d8e..d05a5cc 100644 --- a/library/decort_lb.py +++ b/library/decort_lb.py @@ -135,8 +135,7 @@ class decort_lb(DecortController): self.lb_restore(lb_id=self.lb_id) _, self.lb_facts = self._lb_get_by_id(lb_id=self.lb_id) self.lb_state(self.lb_facts, 'enabled') - self.lb_facts['status'] = "ENABLED" - self.lb_facts['techStatus'] = "STARTED" + _, self.lb_facts = self._lb_get_by_id(lb_id=self.lb_id) self.lb_update( self.lb_facts['primaryNode'], @@ -322,7 +321,7 @@ def main(): decon.action(amodule.params['state']) elif decon.lb_facts['status'] == "DELETED": if amodule.params['state'] in ['present', 'enabled']: - decon.action(restore=True) + decon.action(d_state='started', restore=True) elif (amodule.params['state'] == 'absent' and amodule.params['permanently']): decon.delete() diff --git a/module_utils/decort_utils.py b/module_utils/decort_utils.py index 129f7e5..8b0404c 100644 --- a/module_utils/decort_utils.py +++ b/module_utils/decort_utils.py @@ -4177,7 +4177,7 @@ class DecortController(object): NOP_STATES_FOR_LB_CHANGE = ["MODELED", "DISABLING", "ENABLING", "DELETING", "DELETED", "DESTROYING", "DESTROYED"] - VALID_TARGET_STATES = ["enabled", "disabled","restart"] + VALID_TARGET_STATES = ["enabled", "disabled","restart", 'started'] VALID_TARGET_TSTATES = ["STARTED","STOPPED"] if lb_dict['status'] in NOP_STATES_FOR_LB_CHANGE: