From: francisco.garcia Date: Wed, 13 Dec 2023 21:54:23 +0000 (+0100) Subject: k8s: Fix problem when it restores a 'namespace' X-Git-Tag: Beta-15.0.1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20716c19af895720c770fd9e9b6512fa553ac3c5;p=thirdparty%2Fbacula.git k8s: Fix problem when it restores a 'namespace' --- diff --git a/bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/namespaces.py b/bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/namespaces.py index c7787b763..3fc356cd5 100644 --- a/bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/namespaces.py +++ b/bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/namespaces.py @@ -81,8 +81,10 @@ def namespaces_list_all_names(corev1api): def namespaces_restore(corev1api, file_info, file_content): ns = encoder_load(file_content, file_info.name) metadata = prepare_metadata(ns.metadata) + projectid = None # Populate annotations about projectId - projectid = ns.metadata.annotations.get('field.cattle.io/projectId', None) + if ns.metadata.annotations is not None: + projectid = ns.metadata.annotations.get('field.cattle.io/projectId', None) if projectid is not None: ann = {'field.cattle.io/projectId': projectid} if metadata.annotations is not None: