From 336fd0951454d235af090b494d63dd11c6bf8702 Mon Sep 17 00:00:00 2001 From: Ralf Grubenmann Date: Fri, 11 Oct 2024 10:56:15 +0200 Subject: [PATCH] fix: only patch jupyter servers once in migration (#1994) --- resource_schema_migrations/migration_1.py | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/resource_schema_migrations/migration_1.py b/resource_schema_migrations/migration_1.py index f229c31f..907eb152 100644 --- a/resource_schema_migrations/migration_1.py +++ b/resource_schema_migrations/migration_1.py @@ -52,22 +52,22 @@ def adjust_annotations(args): else: print(f"No need to patch {js_name} for annotation {annotation_key}") - patch = { - "metadata": { - "labels": {f"{args.prefix}{config.SCHEMA_VERSION_LABEL_NAME}": "1"}, - } + patch = { + "metadata": { + "labels": {f"{args.prefix}{config.SCHEMA_VERSION_LABEL_NAME}": "1"}, } - if len(annotation_patches.keys()) > 0: - patch["metadata"]["annotations"] = annotation_patches - if not args.dry_run: - k8s_api.patch_namespaced_custom_object( - group=args.group, - version=args.api_version, - namespace=args.namespace, - plural=args.plural, - name=js_name, - body=patch, - ) + } + if len(annotation_patches.keys()) > 0: + patch["metadata"]["annotations"] = annotation_patches + if not args.dry_run: + k8s_api.patch_namespaced_custom_object( + group=args.group, + version=args.api_version, + namespace=args.namespace, + plural=args.plural, + name=js_name, + body=patch, + ) next_page = jss["metadata"].get("continue") if next_page is None or next_page == "":