def destroy(self): self.log.info("[action] > destroy\n") return_code, stdout, stderr = self.terraform.destroy( capture_output='yes', no_color=IsNotFlagged) self.log.info("Destroyed with return code: " + str(return_code)) statepath = self.config["statepath"] statebakpath = self.config["statepath"] + ".backup" if os.path.exists(statepath) and return_code == 0: try: os.remove(statepath) os.remove(statebakpath) except Exception as e: self.log.error("not able to delete state file") self.log.info( "attack_range has been destroy using terraform successfully") if self.config["kubernetes"] == "1": kubernetes_service.delete_application(self.config, self.log) self.log.info("[action] > destroy\n") return_code, stdout, stderr = self.terraform.destroy( capture_output='yes', no_color=IsNotFlagged, force=IsNotFlagged, auto_approve=True) self.log.info( "attack_range has been destroy using terraform successfully")
def destroy(self): if self.config["kubernetes"] == "1": kubernetes_service.delete_application(self.config, self.log) self.log.info("[action] > destroy\n") return_code, stdout, stderr = self.terraform.destroy( capture_output='yes', no_color=IsNotFlagged) self.log.info( "attack_range has been destroy using terraform successfully")