From 6474cfaf6a2b3047c4dd41fbd70cac984931b54b Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Dec 2022 11:38:18 +0100 Subject: [PATCH] fix pre-commit --- hotpatch/2212/HP1.patch | 10 +++++----- includes/patch.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hotpatch/2212/HP1.patch b/hotpatch/2212/HP1.patch index 85a49410..72e293a9 100644 --- a/hotpatch/2212/HP1.patch +++ b/hotpatch/2212/HP1.patch @@ -26,7 +26,7 @@ index c7180147a5f..941de79da45 100644 +++ plugins/chart_releases_linux/resources.py @@ -158,13 +158,13 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): } - + for pv in chart_release['resources']['persistent_volumes']: - claim_name = pv['spec'].get('claim_ref', {}).get('name') + claim_name = pv['spec'].get('claimRef', {}).get('name') @@ -51,7 +51,7 @@ index c7180147a5f..941de79da45 100644 + 'zv_details': zfs_volumes[csi_spec['volumeHandle']], } return mapping - + @@ -247,11 +247,11 @@ async def get_workload_storage_details(self): # because of chart release reclaim policy being retain for pv in await self.middleware.call( @@ -81,7 +81,7 @@ index 117dab3a79c..e9525150278 100644 - for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['owner_references'] or []): + for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['ownerReferences'] or []): mapping[key][owner_reference['uid']][r['metadata']['uid']] = r - + pod_mapping = defaultdict(list) diff --git plugins/kubernetes_linux/restore.py plugins/kubernetes_linux/restore.py index 4897e3f8b7a..ec13a332b6e 100644 @@ -90,7 +90,7 @@ index 4897e3f8b7a..ec13a332b6e 100644 @@ -218,7 +218,11 @@ def restore_backup(self, job, backup_name, options): failed_pv_restores.append(f'Unable to create ZFS Volume for {pvc!r} PVC: {e}') continue - + + # We need to safely access claim_ref vollume attribute keys as with k8s client api re-write + # camel casing which was done by kubernetes asyncio package is not happening anymore pv_spec = pv['pv_details']['spec'] @@ -122,4 +122,4 @@ index 4897e3f8b7a..ec13a332b6e 100644 + 'storageClassName': pv_spec.get('storage_class_name') or pv_spec['storageClassName'], }, }) - except Exception as e: \ No newline at end of file + except Exception as e: diff --git a/includes/patch.sh b/includes/patch.sh index aa5e80f2..fe0e67da 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -13,4 +13,4 @@ if [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" patchv22120 fi } -export -f hotpatch \ No newline at end of file +export -f hotpatch