Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
fix(boot): show a warning instead of error if a Deployment is in prog…
Browse files Browse the repository at this point in the history
…ress when Deis Workflow is starting up

Move in progress exception out of the main deploy() catch block so it does not get masked as ServicesUnavailable
  • Loading branch information
helgi committed Jul 27, 2016
1 parent e7a1b6f commit e99b852
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion rootfs/api/management/commands/load_db_state_to_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.shortcuts import get_object_or_404

from api.models import Key, App, Domain, Certificate, Config
from api.exceptions import DeisException
from api.exceptions import DeisException, AlreadyExists


class Command(BaseCommand):
Expand Down Expand Up @@ -37,6 +37,10 @@ def handle(self, *args, **options):

try:
application.deploy(rel)
except AlreadyExists as error:
print('WARNING: {} has a deployment in progress. '
'Skipping deployment...'.format(application))
continue
except DeisException as error:
print('ERROR: There was a problem deploying {} '
'due to {}'.format(application, str(error)))
Expand Down
10 changes: 5 additions & 5 deletions rootfs/api/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ def deploy(self, release, force_deploy=False):
deploys = OrderedDict(sorted(deploys.items(), key=lambda d: d[1].get('routable')))

for scale_type, kwargs in deploys.items():
try:
# Is there an existing deployment in progress?
name = self._get_job_id(scale_type)
if not force_deploy and release.deployment_in_progress(self.id, name):
raise AlreadyExists('Deployment for {} is already in progress'.format(name))
# Is there an existing deployment in progress?
name = self._get_job_id(scale_type)
if not force_deploy and release.deployment_in_progress(self.id, name):
raise AlreadyExists('Deployment for {} is already in progress'.format(name))

try:
self._scheduler.deploy(
namespace=self.id,
name=self._get_job_id(scale_type),
Expand Down

0 comments on commit e99b852

Please sign in to comment.