docker_node_info: improve error handling (#63418)
* Improve error handling for get_service_inspect(). * Add changelog fragment.
This commit is contained in:
parent
7f643690c7
commit
d753168e9d
2 changed files with 5 additions and 3 deletions
3
changelogs/fragments/63418-docker_node_info-errors.yml
Normal file
3
changelogs/fragments/63418-docker_node_info-errors.yml
Normal file
|
@ -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…
Reference in a new issue