Skip to content

Commit

Permalink
Make sure we do all in our power to release an environment
Browse files Browse the repository at this point in the history
  • Loading branch information
t-persson committed Apr 25, 2024
1 parent 037a9b7 commit 08bacf7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/execution_space_provider/utilities/external_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from etos_lib.lib.http import Http
from jsontas.jsontas import JsonTas
from packageurl import PackageURL
from requests.exceptions import HTTPError
from requests.exceptions import HTTPError, ConnectionError as RequestsConnectionError
from urllib3.util import Retry

from environment_provider.lib.encrypt import encrypt
Expand Down Expand Up @@ -132,6 +132,11 @@ def checkin(self, execution_space: ExecutionSpace) -> None:
raise ExecutionSpaceCheckinFailed(
f"Unable to check in {execution_spaces} " f"({response.get('error')})"
)
except RequestsConnectionError as error:
if "connection refused" in str(error).lower():
self.logger.error("Error connecting to %r: %r", host, error)
continue
raise
except ConnectionError:
self.logger.error("Error connecting to %r", host)
continue
Expand Down
7 changes: 6 additions & 1 deletion src/iut_provider/utilities/external_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from etos_lib.lib.http import Http
from jsontas.jsontas import JsonTas
from packageurl import PackageURL
from requests.exceptions import HTTPError
from requests.exceptions import HTTPError, ConnectionError as RequestsConnectionError
from urllib3.util import Retry

from ..exceptions import IutCheckinFailed, IutCheckoutFailed, IutNotAvailable
Expand Down Expand Up @@ -122,6 +122,11 @@ def checkin(self, iut: Iut) -> None:
response = response.json()
if response.get("error") is not None:
raise IutCheckinFailed(f"Unable to check in {iuts} ({response.get('error')})")
except RequestsConnectionError as error:
if "connection refused" in str(error).lower():
self.logger.error("Error connecting to %r: %r", host, error)
continue
raise
except ConnectionError:
self.logger.error("Error connecting to %r", host)
continue
Expand Down
7 changes: 6 additions & 1 deletion src/log_area_provider/utilities/external_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from etos_lib.lib.http import Http
from jsontas.jsontas import JsonTas
from packageurl import PackageURL
from requests.exceptions import HTTPError
from requests.exceptions import HTTPError, ConnectionError as RequestsConnectionError
from urllib3.util import Retry

from ..exceptions import LogAreaCheckinFailed, LogAreaCheckoutFailed, LogAreaNotAvailable
Expand Down Expand Up @@ -126,6 +126,11 @@ def checkin(self, log_area: LogArea) -> None:
raise LogAreaCheckinFailed(
f"Unable to check in {log_areas} ({response.get('error')})"
)
except RequestsConnectionError as error:
if "connection refused" in str(error).lower():
self.logger.error("Error connecting to %r: %r", host, error)
continue
raise
except ConnectionError:
self.logger.error("Error connecting to %r", host)
continue
Expand Down

0 comments on commit 08bacf7

Please sign in to comment.