mirror of
https://github.com/docker/compose.git
synced 2025-07-26 23:24:05 +02:00
Remove redundant try/except
Code cleanup. We no longer need this as the api returns a 304 for any stopped containers, which doesn't raise an error. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
6f0096c87b
commit
a772a0d7d7
@ -439,17 +439,6 @@ class Service(object):
|
|||||||
else:
|
else:
|
||||||
raise Exception("Invalid action: {}".format(action))
|
raise Exception("Invalid action: {}".format(action))
|
||||||
|
|
||||||
def _recreate_stop_container(self, container, timeout):
|
|
||||||
try:
|
|
||||||
container.stop(timeout=timeout)
|
|
||||||
except APIError as e:
|
|
||||||
if (e.response.status_code == 500
|
|
||||||
and e.explanation
|
|
||||||
and 'no such process' in str(e.explanation)):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
def recreate_container(self,
|
def recreate_container(self,
|
||||||
container,
|
container,
|
||||||
timeout=DEFAULT_TIMEOUT,
|
timeout=DEFAULT_TIMEOUT,
|
||||||
@ -462,7 +451,7 @@ class Service(object):
|
|||||||
"""
|
"""
|
||||||
log.info("Recreating %s" % container.name)
|
log.info("Recreating %s" % container.name)
|
||||||
|
|
||||||
self._recreate_stop_container(container, timeout)
|
container.stop(timeout=timeout)
|
||||||
container.rename_to_tmp_name()
|
container.rename_to_tmp_name()
|
||||||
new_container = self.create_container(
|
new_container = self.create_container(
|
||||||
do_build=False,
|
do_build=False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user