From 3d91245df95c821157e5ae92ef03ff3a583f1de5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Gmerek Date: Mon, 9 Dec 2024 10:24:03 +0100 Subject: [PATCH] Makes Multus lib return False on error 401 instead of raising an exception --- lib/charms/kubernetes_charm_libraries/v0/multus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/charms/kubernetes_charm_libraries/v0/multus.py b/lib/charms/kubernetes_charm_libraries/v0/multus.py index 9ea34fa..e5bb69f 100644 --- a/lib/charms/kubernetes_charm_libraries/v0/multus.py +++ b/lib/charms/kubernetes_charm_libraries/v0/multus.py @@ -249,7 +249,7 @@ def network_attachment_definition_is_created( ) return False except httpx.HTTPStatusError as e: - if e.response.status_code == 404: + if e.response.status_code in [401, 404]: raise KubernetesMultusError( "NetworkAttachmentDefinition resource not found. " "You may need to install Multus CNI."