From bff271bf0714df130826471fe152a1e24d64681d Mon Sep 17 00:00:00 2001 From: Anish Reddy Ravula <2anishreddy@gmail.com> Date: Mon, 15 Apr 2024 15:05:35 -0500 Subject: [PATCH] Extra properties in lease detailed get Change-Id: I936a515410075b793c5addf0139cfb130d99a96a --- blazar/manager/service.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/blazar/manager/service.py b/blazar/manager/service.py index 9859c3c1..7ed1b1ef 100644 --- a/blazar/manager/service.py +++ b/blazar/manager/service.py @@ -322,13 +322,28 @@ def get_lease(self, lease_id): return db_api.lease_get(lease_id) def hosts_in_lease(self, lease_id): - return db_api.hosts_in_lease(lease_id) + hosts = db_api.hosts_in_lease(lease_id) + for host in hosts: + extra_capabilities = self._get_extra_capabilities(host['id']) + if host is not None and extra_capabilities: + host.update(extra_capabilities) + return hosts def networks_in_lease(self, lease_id): - return db_api.networks_in_lease(lease_id) + networks = db_api.networks_in_lease(lease_id) + for network in networks: + extra_capabilities = self._get_extra_capabilities(network['id']) + if network is not None and extra_capabilities: + network.update(extra_capabilities) + return networks def devices_in_lease(self, lease_id): - return db_api.devices_in_lease(lease_id) + devices = db_api.devices_in_lease(lease_id) + for device in devices: + extra_capabilities = self._get_extra_capabilities(device['id']) + if device is not None and extra_capabilities: + device.update(extra_capabilities) + return devices def list_leases(self, project_id=None, query=None): return db_api.lease_list(project_id)