mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 19:50:25 -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
|
@ -218,7 +218,7 @@ class DockerHostManager(DockerBaseClass):
|
|||
try:
|
||||
return self.client.info()
|
||||
except APIError as exc:
|
||||
self.client.fail_json(msg="Error inspecting docker host: %s" % to_native(exc))
|
||||
self.client.fail("Error inspecting docker host: %s" % to_native(exc))
|
||||
|
||||
def get_docker_disk_usage_facts(self):
|
||||
try:
|
||||
|
@ -227,7 +227,7 @@ class DockerHostManager(DockerBaseClass):
|
|||
else:
|
||||
return dict(LayerSize=self.client.df()['LayersSize'])
|
||||
except APIError as exc:
|
||||
self.client.fail_json(msg="Error inspecting docker host: %s" % to_native(exc))
|
||||
self.client.fail("Error inspecting docker host: %s" % to_native(exc))
|
||||
|
||||
def get_docker_items_list(self, docker_object=None, filters=None, verbose=False):
|
||||
items = None
|
||||
|
@ -248,8 +248,8 @@ class DockerHostManager(DockerBaseClass):
|
|||
elif docker_object == 'volumes':
|
||||
items = self.client.volumes(filters=filters)
|
||||
except APIError as exc:
|
||||
self.client.fail_json(msg="Error inspecting docker host for object '%s': %s" %
|
||||
(docker_object, to_native(exc)))
|
||||
self.client.fail("Error inspecting docker host for object '%s': %s" %
|
||||
(docker_object, to_native(exc)))
|
||||
|
||||
if self.verbose_output:
|
||||
if docker_object != 'volumes':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue