Fix CI: More Specific Error

This commit is contained in:
erik 2023-04-19 15:23:29 +02:00
parent 44d1708448
commit e31b4ef7b2
2 changed files with 8 additions and 8 deletions

View file

@ -37,7 +37,7 @@ class DevopsImageBuild(DevopsBuild):
self.image_build_service = ImageBuildService()
if not image:
if not config:
raise Exception("Image parameters could not be set.")
raise ValueError("Image parameters could not be set.")
super().__init__(project, config=config)
image = Image(
dockerhub_user=config["dockerhub_user"],

View file

@ -138,7 +138,7 @@ class DevopsTerraformBuild(DevopsBuild):
self.post_build()
self.print_terraform_command(terraform)
if return_code > 0:
raise Exception(return_code, "terraform error:", stderr)
raise RuntimeError(return_code, "terraform error:", stderr)
def plan_fail_on_diff(self):
terraform = self.init_client()
@ -148,9 +148,9 @@ class DevopsTerraformBuild(DevopsBuild):
self.post_build()
self.print_terraform_command(terraform)
if return_code not in (0, 2):
raise Exception(return_code, "terraform error:", stderr)
raise RuntimeError(return_code, "terraform error:", stderr)
if return_code == 2:
raise Exception(return_code, "diff in config found:", stderr)
raise RuntimeError(return_code, "diff in config found:", stderr)
def apply(self, auto_approve=False):
terraform = self.init_client()
@ -172,7 +172,7 @@ class DevopsTerraformBuild(DevopsBuild):
self.post_build()
self.print_terraform_command(terraform)
if return_code > 0:
raise Exception(return_code, "terraform error:", stderr)
raise RuntimeError(return_code, "terraform error:", stderr)
def refresh(self):
terraform = self.init_client()
@ -183,7 +183,7 @@ class DevopsTerraformBuild(DevopsBuild):
self.post_build()
self.print_terraform_command(terraform)
if return_code > 0:
raise Exception(return_code, "terraform error:", stderr)
raise RuntimeError(return_code, "terraform error:", stderr)
def destroy(self, auto_approve=False):
terraform = self.init_client()
@ -204,7 +204,7 @@ class DevopsTerraformBuild(DevopsBuild):
self.post_build()
self.print_terraform_command(terraform)
if return_code > 0:
raise Exception(return_code, "terraform error:", stderr)
raise RuntimeError(return_code, "terraform error:", stderr)
def tf_import(self, tf_import_name, tf_import_resource,):
terraform = self.init_client()
@ -215,7 +215,7 @@ class DevopsTerraformBuild(DevopsBuild):
self.post_build()
self.print_terraform_command(terraform)
if return_code > 0:
raise Exception(return_code, "terraform error:", stderr)
raise RuntimeError(return_code, "terraform error:", stderr)
def print_terraform_command(self, terraform):
if self.debug_print_terraform_command: