Fix CI: Raise specific exception.

Do comparison with !=.
This commit is contained in:
erik 2023-04-19 11:57:26 +02:00
parent 0a85790410
commit c530628192

View file

@ -1,5 +1,5 @@
from typing import Optional
from pybuilder.core import Project
from pybuilder.core import Project
from src.main.python.ddadevops.devops_build import DevopsBuild
from src.main.python.ddadevops.infrastructure.release_mixin import ReleaseRepository, ReleaseTypeRepository, VersionRepository, GitApi, EnvironmentApi
from src.main.python.ddadevops.application import PrepareReleaseService, TagAndPushReleaseService
@ -23,7 +23,7 @@ class ReleaseMixin(DevopsBuild):
def __init__(self, project: Project, config: Optional[dict] = None, release_config: Optional[ReleaseConfig] = None):
if not release_config:
if not config:
raise Exception("Release parameters could not be set.")
raise ValueError("Release parameters could not be set.")
super().__init__(project, config=config)
release_mixin_config = config['ReleaseMixin']
release_config = ReleaseConfig(
@ -38,8 +38,8 @@ class ReleaseMixin(DevopsBuild):
git_api = GitApi()
environment_api = EnvironmentApi()
env_key = EnvironmentKeys.DDADEVOPS_RELEASE_TYPE.name
environment_val_set = environment_api.get(env_key) is not "" and environment_api.get(env_key) is not None
environment_val_set = environment_api.get(env_key) != "" and environment_api.get(env_key) is not None
if environment_val_set:
release_type_repo = ReleaseTypeRepository.from_environment(environment_api)
else: