Skip to content

Commit ccb3dda

Browse files
author
Clark Perkins
committed
Pulled a couple bugs from master
1 parent c47aa8b commit ccb3dda

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

stackdio/api/stacks/serializers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import os
2121
import string
2222

23+
import six
2324
import salt.cloud
2425
from django.conf import settings
2526
from django.contrib.contenttypes.models import ContentType
@@ -284,8 +285,13 @@ def __call__(self):
284285
blueprint_id = self._context.initial_data.get('blueprint', None)
285286
if blueprint_id is None:
286287
return None
287-
blueprint = Blueprint.objects.get(pk=blueprint_id)
288-
return blueprint.create_users
288+
if not isinstance(blueprint_id, six.integer_types):
289+
return None
290+
try:
291+
blueprint = Blueprint.objects.get(pk=blueprint_id)
292+
return blueprint.create_users
293+
except Blueprint.DoesNotExist:
294+
return None
289295

290296

291297
class StackSerializer(CreateOnlyFieldsMixin, StackdioHyperlinkedModelSerializer):

stackdio/api/stacks/tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,8 @@ def destroy_stack(stack_id):
16941694
level=Stack.ERROR)
16951695
else:
16961696
# delete the stack storage directory
1697-
shutil.rmtree(stack.get_root_directory())
1697+
if os.path.exists(stack.get_root_directory()):
1698+
shutil.rmtree(stack.get_root_directory())
16981699
stack.delete()
16991700

17001701
except Stack.DoesNotExist:

0 commit comments

Comments
 (0)