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

Commit c02eb51

Browse files
lshemeshMatthew Fisher
authored andcommitted
fix(api/models/app): Catch unhandled error (#1317)
Fix for #1313 An unhandled exception in ns.create due to "Conflict namespaces" will wipe out an entire namespace. I've added a catch here to protect against that occurring.
1 parent ccd4387 commit c02eb51

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rootfs/api/models/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ def create(self, *args, **kwargs): # noqa
198198
try:
199199
self._scheduler.ns.get(namespace)
200200
except KubeException:
201-
self._scheduler.ns.create(namespace)
201+
try:
202+
self._scheduler.ns.create(namespace)
203+
except KubeException as e:
204+
raise ServiceUnavailable('Could not create the Namespace in Kubernetes') from e
205+
202206
if settings.KUBERNETES_NAMESPACE_DEFAULT_QUOTA_SPEC != '':
203207
quota_spec = json.loads(settings.KUBERNETES_NAMESPACE_DEFAULT_QUOTA_SPEC)
204208
self.log('creating Quota {} for namespace {}'.format(quota_name, namespace),

0 commit comments

Comments
 (0)