Skip to content

Commit

Permalink
fix(Beaker): Do not throw an Exception when not authenticated
Browse files Browse the repository at this point in the history
Signed-off-by: Tibor Dudlák <[email protected]>
  • Loading branch information
Tiboris committed Sep 20, 2022
1 parent 98255c7 commit d1b794b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/mrack/providers/beaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
from bkr.client import BeakerJob, BeakerRecipe, BeakerRecipeSet
from bkr.common.hub import HubProxy
from bkr.common.pyconfig import PyConfigParser
from gssapi.exceptions import MissingCredentialsError

from mrack.errors import ProvisioningError, ValidationError
from mrack.errors import NotAuthenticatedError, ProvisioningError, ValidationError
from mrack.host import (
STATUS_ACTIVE,
STATUS_DELETED,
Expand Down Expand Up @@ -116,7 +117,14 @@ async def init(
os.environ.get("BEAKER_CONF", "/etc/beaker/client.conf") # TODO use provc
) # get the beaker config for initialization of hub
self.conf.load_from_file(default_config)
self.hub = HubProxy(logger=logger, conf=self.conf)
try:
self.hub = HubProxy(logger=logger, conf=self.conf)
except MissingCredentialsError as kinit_err:
raise NotAuthenticatedError(
f"{self.dsp_name} needs Kerberos ticket to authenticate to BeakerHub. "
"Run 'kinit $USER' command to obtain Kerberos credentials."
) from kinit_err

login_end = datetime.now()
login_duration = login_end - login_start
logger.info(f"{self.dsp_name} Init duration {login_duration}")
Expand Down

0 comments on commit d1b794b

Please sign in to comment.