From ca2f1306a8c941e426716d55ee24d16023e2c1bd Mon Sep 17 00:00:00 2001 From: Lanfon Date: Tue, 20 Aug 2024 09:42:36 +0800 Subject: [PATCH] * [apiclient] fix KeyError when removing empty key (#1437) --- apiclient/harvester_api/managers/virtualmachines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiclient/harvester_api/managers/virtualmachines.py b/apiclient/harvester_api/managers/virtualmachines.py index 549abc0b5..5e5265d03 100644 --- a/apiclient/harvester_api/managers/virtualmachines.py +++ b/apiclient/harvester_api/managers/virtualmachines.py @@ -35,7 +35,7 @@ def get_status(self, name="", namespace=DEFAULT_NAMESPACE, *, raw=False, **kwarg def create(self, name, vm_spec, namespace=DEFAULT_NAMESPACE, *, raw=False): if isinstance(vm_spec, self.Spec): vm_spec = self.Spec.to_dict(vm_spec, name, namespace) - vm_spec['metadata'].pop('resourceVersion') # remove for create new ones + vm_spec['metadata'].pop('resourceVersion', None) # remove for create new ones path = self.PATH_fmt.format(uid="", ns=namespace) return self._create(path, json=vm_spec, raw=raw)