mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
docker_*: always use client.fail() over module.fail_json(), allow to always return data on failure (#51999)
* Always use client.fail() instead of module.fail_json(). * Allow to pass on results on module failure. * Linting.
This commit is contained in:
parent
ad386290b4
commit
d7fd4d0550
12 changed files with 64 additions and 60 deletions
|
@ -737,7 +737,7 @@ class ContainerManager(DockerBaseClass):
|
|||
except Exception as exc:
|
||||
fail_reason = get_failure_info(exc, out_redir_name, err_redir_name,
|
||||
msg_format="Error starting project %s")
|
||||
self.client.module.fail_json(**fail_reason)
|
||||
self.client.fail(**fail_reason)
|
||||
else:
|
||||
cleanup_redirection_tempfiles(out_redir_name, err_redir_name)
|
||||
|
||||
|
@ -950,7 +950,7 @@ class ContainerManager(DockerBaseClass):
|
|||
except Exception as exc:
|
||||
fail_reason = get_failure_info(exc, out_redir_name, err_redir_name,
|
||||
msg_format="Error stopping project %s")
|
||||
self.client.module.fail_json(**fail_reason)
|
||||
self.client.fail(**fail_reason)
|
||||
else:
|
||||
cleanup_redirection_tempfiles(out_redir_name, err_redir_name)
|
||||
return result
|
||||
|
@ -985,7 +985,7 @@ class ContainerManager(DockerBaseClass):
|
|||
except Exception as exc:
|
||||
fail_reason = get_failure_info(exc, out_redir_name, err_redir_name,
|
||||
msg_format="Error restarting project %s")
|
||||
self.client.module.fail_json(**fail_reason)
|
||||
self.client.fail(**fail_reason)
|
||||
else:
|
||||
cleanup_redirection_tempfiles(out_redir_name, err_redir_name)
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue