S3 cleanup was not performed when create stack throws ValidationError
Creating a stack with wrong/lacking parameter input, cfn.create_change_set throws ValidationError. And checking in S3, the uploaded file still exists thus, cleanup was not performed. This is just a minor issue but when ran in different regions and for different projects this would cause burden to the user.
diff --git a/taskcat/stacker.py b/taskcat/stacker.py
index 7e96641..bc1574e 100755
--- a/taskcat/stacker.py
+++ b/taskcat/stacker.py
@@ -751,7 +751,10 @@ class TaskCat(object):
             except Exception as e:
                 if self.verbose:
                     print(D + str(e))
-                sys.exit(F + "Cannot validate %s" % self.get_template_file())
+                print(F + "Cannot validate %s" % self.get_template_file())
+                print(I + "Deleting any automatically-created buckets...")
+                self.delete_autobucket()
+                sys.exit(1)
         print('\\n')
         return True
 
@@ -1461,6 +1464,12 @@ class TaskCat(object):
                         ))
                 s.delete_all(failed_stacks)
 
+        self.delete_autobucket()
+
+    def delete_autobucket(self):
+        """
+        This function deletes the automatically created S3 bucket(s) of the current project.
+        """
         # Check to see if auto bucket was created
         if self.get_s3bucket_type() is 'auto':
             print(I + "(Cleaning up staging assets)")
['taskcat/stacker.py']