1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use exception as syntax in inventory, as it doesn't require py24 (#15554)

This commit is contained in:
Matt Martz 2016-04-22 15:34:35 -05:00 committed by Brian Coca
parent 0eead1a3f6
commit 5549292d69

View file

@ -374,7 +374,7 @@ try:
from docker.errors import APIError, TLSParameterError from docker.errors import APIError, TLSParameterError
from docker.tls import TLSConfig from docker.tls import TLSConfig
from docker.constants import DEFAULT_TIMEOUT_SECONDS, DEFAULT_DOCKER_API_VERSION from docker.constants import DEFAULT_TIMEOUT_SECONDS, DEFAULT_DOCKER_API_VERSION
except ImportError, exc: except ImportError as exc:
HAS_DOCKER_ERROR = str(exc) HAS_DOCKER_ERROR = str(exc)
HAS_DOCKER_PY = False HAS_DOCKER_PY = False
@ -423,9 +423,9 @@ class AnsibleDockerClient(Client):
try: try:
super(AnsibleDockerClient, self).__init__(**self._connect_params) super(AnsibleDockerClient, self).__init__(**self._connect_params)
except APIError, exc: except APIError as exc:
self.fail("Docker API error: %s" % exc) self.fail("Docker API error: %s" % exc)
except Exception, exc: except Exception as exc:
self.fail("Error connecting: %s" % exc) self.fail("Error connecting: %s" % exc)
def fail(self, msg): def fail(self, msg):
@ -442,7 +442,7 @@ class AnsibleDockerClient(Client):
try: try:
tls_config = TLSConfig(**kwargs) tls_config = TLSConfig(**kwargs)
return tls_config return tls_config
except TLSParameterError, exc: except TLSParameterError as exc:
self.fail("TLS config error: %s" % exc) self.fail("TLS config error: %s" % exc)
def _get_connect_params(self): def _get_connect_params(self):