File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import os
2121import string
2222
23+ import six
2324import salt .cloud
2425from django .conf import settings
2526from 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
291297class StackSerializer (CreateOnlyFieldsMixin , StackdioHyperlinkedModelSerializer ):
Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments