diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-10-27 09:12:28 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-10-27 09:12:28 +0200 |
| commit | cad597868f88fb783a94c8d0bb169d0540d1f32e (patch) | |
| tree | 784c7aaee94a890187f1c7f18453ed67dcacfc66 | |
| parent | 01fd3c2d66f88172027d4cf38232e358ac0ff3a5 (diff) | |
Minor changes
| -rw-r--r-- | clusterman/commands/frontend.py | 16 |
1 files 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") |
