diff --git a/changelogs/fragments/proj_sync.yml b/changelogs/fragments/proj_sync.yml new file mode 100644 index 0000000..6b94c3e --- /dev/null +++ b/changelogs/fragments/proj_sync.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - Fixes issue where project sync reports fail because it is already running +... diff --git a/plugins/module_utils/eda_module.py b/plugins/module_utils/eda_module.py index 8ee598a..138000e 100644 --- a/plugins/module_utils/eda_module.py +++ b/plugins/module_utils/eda_module.py @@ -822,11 +822,21 @@ def sync_project(self, id, wait=True, interval=1, timeout=None): self.fail_json(msg="The project sync failed", task=project["import_error"]) else: if "json" in response and "__all__" in response["json"]: - self.fail_json(msg="Unable to sync project: {0}".format(response["json"]["__all__"][0])) + if "detail" in response["json"]["__all__"][0] and response["json"]["__all__"][0]["detail"] == "Project import or sync is already running.": + self.json_output["changed"] = False + self.json_output["detail"] = response["json"]["__all__"][0]["detail"] + self.exit_json(**self.json_output) + else: + self.fail_json(msg="Unable to sync project: {0}".format(response["json"]["__all__"][0])) elif "json" in response: # This is from a project delete (if there is an active job against it) if "error" in response["json"]: - self.fail_json(msg="Unable to sync project: {0}".format(response["json"]["error"])) + if "detail" in response["json"]["error"] and response["json"]["error"]["detail"] == "Project import or sync is already running.": + self.json_output["changed"] = False + self.json_output["detail"] = response["json"]["error"]["detail"] + self.exit_json(**self.json_output) + else: + self.fail_json(msg="Unable to sync project: {0}".format(response["json"]["error"])) else: self.fail_json(msg="Unable to sync project: {0}".format(response["json"])) else: