Skip to content

Commit

Permalink
fixed issue #360 hasync and hafailover
Browse files Browse the repository at this point in the history
Signed-off-by: Sumanth Lingappa <sumanth.lingappa@cloud.com>
  • Loading branch information
sumanth-lingappa committed Feb 9, 2024
1 parent 18c57ee commit b2801d9
Show file tree
Hide file tree
Showing 5 changed files with 924 additions and 5 deletions.
7 changes: 6 additions & 1 deletion plugins/module_utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,12 @@ def get_valid_desired_states(resource_name):
# 'unsign', 'Install', 'Ping', 'export', 'save', 'expire', 'get-all', 'flush', 'unlock', 'diff', 'Import',
# 'disable', 'create', 'sign', 'get', 'apply', 'restore', 'unlink', 'link', 'count', 'join', 'renumber', 'sync'
supported_operations = NITRO_RESOURCE_MAP[resource_name]["_supported_operations"]
if "add" in supported_operations or "update" in supported_operations:
if (
"add" in supported_operations
or "update" in supported_operations
or "Force" in supported_operations
or "force" in supported_operations
):
desired_states.add("present")
if "delete" in supported_operations:
desired_states.add("absent")
Expand Down
12 changes: 12 additions & 0 deletions plugins/module_utils/module_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,17 @@ def config_save(self):
if not ok:
self.return_failure(err)
self.module_result["changed"] = True
self.update_diff_list(custom_msg="+ CONFIG SAVED")
self.return_success()

@trace
def force(self):
# resources like hasync, hafailover, clustersync have `force` action
self.act_on_resource(action="force")
self.module_result["changed"] = True
self.update_diff_list(
custom_msg="+ %s applied" % (self.resource_name.upper())
)
self.return_success()

@trace
Expand Down Expand Up @@ -902,6 +913,7 @@ def main(self):
ok, err = save_config(self.client)
if not ok:
self.return_failure(err)
self.update_diff_list(custom_msg="+ CONFIG SAVED")
self.return_success()
except Exception as e:
msg = "Exception %s: %s" % (type(e), str(e))
Expand Down
Loading

0 comments on commit b2801d9

Please sign in to comment.