support for %%currenthost%% host names for modules in ci_infra

It can be set using nodes and svr_node tags in xml files
This commit is contained in:
Bipin Adhikari
2024-09-04 15:38:51 +02:00
committed by Raphael Defosseux
parent 5a49dd9afa
commit 150a00bd23
24 changed files with 164 additions and 30 deletions
+6 -2
View File
@@ -41,14 +41,18 @@ import cls_cmd
class Module_UE:
def __init__(self, module_name, filename="ci_infra.yaml"):
def __init__(self, module_name, node=None, filename="ci_infra.yaml"):
with open(filename, 'r') as f:
all_ues = yaml.load(f, Loader=yaml.FullLoader)
m = all_ues.get(module_name)
if m is None:
raise Exception(f'no such module name "{module_name}" in "{filename}"')
self.module_name = module_name
self.host = m['Host']
self.host = m['Host'] if m['Host'] != "%%current_host%%" else None
if node is None and self.host is None:
raise Exception(f'node not provided when needed')
elif node is not None and self.host is None:
self.host = node
self.cmd_dict = {
"attach": m.get('AttachScript'),
"detach": m.get('DetachScript'),