From cad597868f88fb783a94c8d0bb169d0540d1f32e Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 27 Oct 2023 09:12:28 +0200 Subject: [PATCH] Minor changes --- clusterman/commands/frontend.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/clusterman/commands/frontend.py b/clusterman/commands/frontend.py index 26d4409..963357b 100644 --- a/clusterman/commands/frontend.py +++ b/clusterman/commands/frontend.py @@ -1,9 +1,7 @@ -import os, json +import os, json, re from clusterman.config import CONF - - def info(): nodes=None if os.path.exists(CONF.NODE_FILE): @@ -22,7 +20,17 @@ def info(): # Groups print("Node groups: ",end="") if len(CONF["cluster"]["groups"]) > 0: - print(",".join(CONF["cluster"]["groups"].keys())) + pattern=None + for group in CONF["cluster"]["groups"].keys(): + if not pattern == None: + print(", ", end="") + pattern = re.compile(CONF["cluster"]["groups"][group]) + count=0 + for ip in nodes: + if pattern.match(ip): + count=count+1 + print("{}({})".format(group,count),end="") + print() else: print("NA")