From ccc2fce7fa723d83ca10d05fc69c4ae9fb8dc440 Mon Sep 17 00:00:00 2001 From: Brandon Squizzato Date: Tue, 25 Jan 2022 15:26:38 -0500 Subject: [PATCH] Fix release log msg, check for owner on release --- bonfire/bonfire.py | 5 ++++- bonfire/namespaces.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bonfire/bonfire.py b/bonfire/bonfire.py index c8fdfcb9..d4bc0fe2 100755 --- a/bonfire/bonfire.py +++ b/bonfire/bonfire.py @@ -625,7 +625,7 @@ def _cmd_namespace_reserve(name, requester, duration, timeout, local): "--force", is_flag=True, default=False, - help="Do not check if you own this namespace", + help="Do not ask for confirmation", ) @options([_local_option]) @click_exception_wrapper("namespace release") @@ -636,6 +636,9 @@ def _cmd_namespace_release(namespace, force, local): if not force: _warn_before_delete() + ns = Namespace(name=namespace) + if not ns.owned_by_me: + _warn_if_not_owned_by_me() release_reservation(namespace=namespace, local=local) diff --git a/bonfire/namespaces.py b/bonfire/namespaces.py index 7c6dac20..0f8709cd 100644 --- a/bonfire/namespaces.py +++ b/bonfire/namespaces.py @@ -278,6 +278,7 @@ def reserve_namespace(name, requester, duration, timeout, local=True): def release_reservation(name=None, namespace=None, local=True): res = get_reservation(name=name, namespace=namespace) if res: + res_name = res["metadata"]["name"] res_config = process_reservation( res["metadata"]["name"], res["spec"]["requester"], @@ -286,7 +287,7 @@ def release_reservation(name=None, namespace=None, local=True): ) apply_config(None, list_resource=res_config) - msg = f"releasing reservation '{name}'" + msg = f"releasing reservation '{res_name}'" if namespace: msg += f" namespace '{namespace}'" log.info(msg)