Minor changes

This commit is contained in:
Loïc Guégan 2023-10-26 14:28:11 +02:00
parent d79342a340
commit 20d4f6f28f
2 changed files with 14 additions and 3 deletions

View file

@ -15,6 +15,8 @@ def main():
# Check
node_cmd_scan=node_subparsers.add_parser("check")
node_cmd_scan.add_argument("-t", "--timeout" ,help="Timeout", type=float)
# List
node_cmd_list=node_subparsers.add_parser("list")
##### Frontend commands #####
target_frontend = subparsers.add_parser("frontend")
@ -29,8 +31,6 @@ def main():
# Run the proper handler
if args.target == "node":
print("Do node related stuff")
#node.scan("10.0.0.1","10.0.0.10")
if args.command == "scan":
if args.timeout:
node.scan(node_cmd_scan.timeout)
@ -41,6 +41,8 @@ def main():
node.check(node_cmd_scan.timeout)
else:
node.check(CONF["timeout"])
elif args.command == "list":
node.ls()
else:
target_node.print_help(sys.stderr)
sys.exit(1)

View file

@ -3,7 +3,16 @@ from clusterman.config import CONF
def ls():
print("List nodes..")
nodes_path=CONF["paths"]["nodes"]
nodes=None
if os.path.exists(nodes_path):
with open(nodes_path) as f:
nodes=json.load(f)
else:
print("Please perform a scan before")
exit(0)
for node in nodes:
print(node)
def scan(timeout):