From f2c620c2c56646f3819918bf5e8e18dbe2280533 Mon Sep 17 00:00:00 2001 From: karmab Date: Thu, 24 Oct 2024 22:08:41 +0200 Subject: [PATCH] vsphere: parse ip as metadata --- kvirt/providers/kubevirt/__init__.py | 10 +++++----- kvirt/providers/vsphere/__init__.py | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kvirt/providers/kubevirt/__init__.py b/kvirt/providers/kubevirt/__init__.py index 48e70b191..dc506fdbd 100644 --- a/kvirt/providers/kubevirt/__init__.py +++ b/kvirt/providers/kubevirt/__init__.py @@ -748,11 +748,11 @@ def info(self, name, vm=None, debug=False): 'harvesterhci.io/imageId' in spec['dataVolumeTemplates'][0]['metadata']['annotations']: image = spec['dataVolumeTemplates'][0]['metadata']['annotations']['harvesterhci.io/imageId'].split('/')[1] if annotations is not None: - profile = annotations['kcli/profile'] if 'kcli/profile' in annotations else 'N/A' - plan = annotations['kcli/plan'] if 'kcli/plan' in annotations else 'N/A' - ip = annotations['kcli/ip'] if 'kcli/ip' in annotations else None - kube = annotations['kcli/kube'] if 'kcli/kube' in annotations else None - kubetype = annotations['kcli/kubetype'] if 'kcli/kubetype' in annotations else None + profile = annotations.get('kcli/profile', 'N/A') + plan = annotations.get('kcli/plan', 'N/A') + ip = annotations.get('kcli/ip') + kube = annotations.ge('kcli/kube') + kubetype = annotations.get('kcli/kubetype') if 'kcli/image' in annotations: image = annotations['kcli/image'] host = None diff --git a/kvirt/providers/vsphere/__init__.py b/kvirt/providers/vsphere/__init__.py index 7b43c75a5..78b325456 100644 --- a/kvirt/providers/vsphere/__init__.py +++ b/kvirt/providers/vsphere/__init__.py @@ -836,6 +836,8 @@ def info(self, name, output='plain', fields=[], values=False, vm=None, debug=Fal yamlinfo['user'] = common.get_user(entry.value) if entry.key == 'tags': yamlinfo['tags'] = entry.value + if entry.key == 'ip': + yamlinfo['ip'] = entry.value kubetype = yamlinfo.get('kubetype') cluster_network = yamlinfo.get('cluster_network') ips = []