docker_node_info: improve error handling (#63418)

* Improve error handling for get_service_inspect().

* Add changelog fragment.
pull/63434/head
Felix Fontein 5 years ago committed by GitHub
parent 7f643690c7
commit d753168e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- "docker_node_info - improve error handling when service inspection fails, for example because node name being ambiguous
(https://github.com/ansible/ansible/issues/63353, PR https://github.com/ansible/ansible/pull/63418)."

@ -164,10 +164,9 @@ class AnsibleDockerSwarmClient(AnsibleDockerClient):
if exc.status_code == 503:
self.fail("Cannot inspect node: To inspect node execute module on Swarm Manager")
if exc.status_code == 404:
if skip_missing is False:
self.fail("Error while reading from Swarm manager: %s" % to_native(exc))
else:
if skip_missing:
return None
self.fail("Error while reading from Swarm manager: %s" % to_native(exc))
except Exception as exc:
self.fail("Error inspecting swarm node: %s" % exc)

Loading…
Cancel
Save