Skip to content

Commit

Permalink
Merge pull request #390 from pehala/managedzone_error
Browse files Browse the repository at this point in the history
Improve error message for nonexisting managedzone
  • Loading branch information
pehala authored May 9, 2024
2 parents 00937b8 + b58180e commit 04c96a5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions testsuite/gateway/gateway_api/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from functools import cached_property
from typing import Callable

from openshift_client import selector
from openshift_client import selector, OpenShiftPythonException

from testsuite.certificates import Certificate
from testsuite.config import settings
Expand Down Expand Up @@ -43,7 +43,12 @@ class DNSPolicyExposer(Exposer):
@cached_property
def base_domain(self) -> str:
mz_name = settings["control_plane"]["managedzone"]
zone = selector(f"managedzone/{mz_name}", static_context=self.openshift.context).object()
try:
zone = selector(f"managedzone/{mz_name}", static_context=self.openshift.context).object()
except OpenShiftPythonException as exc:
raise OpenShiftPythonException(
f"Unable to find managedzone/{mz_name} in namespace {self.openshift.project}"
) from exc
return f'{generate_tail(5)}.{zone.model["spec"]["domainName"]}'

def expose_hostname(self, name, gateway: Gateway) -> Hostname:
Expand Down

0 comments on commit 04c96a5

Please sign in to comment.