From 0cd653dfe3d5146b267c6039e93e1e8595c36445 Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Fri, 17 Jan 2025 09:52:07 +0100 Subject: [PATCH] Added extra field inside the response JSON. task_name and data. Made grace-period countdown more verbose. --- meshbook.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/meshbook.py b/meshbook.py index c2f9fc5..153ffaf 100644 --- a/meshbook.py +++ b/meshbook.py @@ -131,7 +131,10 @@ async def execute_playbook(session: meshctrl.Session, targets: dict, playbook: d response[device]["device_name"] = await translate_id_to_name(device, group_list) task_batch.append(response[device]) - responses_list["Task " + str(round)] = task_batch + responses_list["Task " + str(round)] = { + "task_name": task["name"], + "data": task_batch + } round += 1 output_text(("-" * 40), False) @@ -172,7 +175,10 @@ async def main(): output_text(("\033[91mExecuting playbook on the target(s): " + target_name + ".\x1B[0m"), False) if not args.nograce: output_text(("\033[91mInitiating grace-period...\x1B[0m"), False) - await asyncio.sleep(3) + for x in range(3): + output_text(("\033[91m{}...\x1B[0m".format(x+1)), False) + await asyncio.sleep(1) + output_text(("-" * 40), False) await execute_playbook(session, targets_list, playbook, group_list) await session.close()