From 677dce19fdfc9300a8b9c8913fb420a88a93fb63 Mon Sep 17 00:00:00 2001 From: Lili Deng Date: Fri, 21 Oct 2022 17:46:59 +0800 Subject: [PATCH] set value for nodes_raw to avoid regression issue --- lisa/schema.py | 2 ++ lisa/sut_orchestrator/azure/common.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisa/schema.py b/lisa/schema.py index 2f99b3805..f16326b01 100644 --- a/lisa/schema.py +++ b/lisa/schema.py @@ -1155,6 +1155,8 @@ class Environment: if self.nodes_raw: for node_raw in self.nodes_raw: + if not isinstance(node_raw, dict): + node_raw = node_raw.to_dict() node_type = node_raw[constants.TYPE] if node_type == constants.ENVIRONMENTS_NODES_REQUIREMENT: original_req: NodeSpace = load_by_type(NodeSpace, node_raw) diff --git a/lisa/sut_orchestrator/azure/common.py b/lisa/sut_orchestrator/azure/common.py index 09b413aba..eb90bf2ba 100644 --- a/lisa/sut_orchestrator/azure/common.py +++ b/lisa/sut_orchestrator/azure/common.py @@ -1042,12 +1042,14 @@ def load_environment( # create mock environment from environments environment_runbook = schema.Environment() + if environment_runbook.nodes_raw is None: + environment_runbook.nodes_raw = [] compute_client = get_compute_client(platform) vms = compute_client.virtual_machines.list(resource_group_name) for vm in vms: node_schema = schema.RemoteNode(name=vm.name) - environment_runbook.nodes.append(node_schema) + environment_runbook.nodes_raw.append(node_schema) environments = load_environments( schema.EnvironmentRoot(environments=[environment_runbook])