From e0d59b95dde474ce7ccc6c5eaf28196456241d67 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 3 Jul 2024 18:37:33 +0100 Subject: op-mode: T6537: include hostname in the reboot/shutdown warning message (cherry picked from commit dc60fe993505d1adca60f9b6e0f47f565c459331) --- src/op_mode/powerctrl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/op_mode') diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py index cb4a175dd..fb6b54776 100755 --- a/src/op_mode/powerctrl.py +++ b/src/op_mode/powerctrl.py @@ -117,11 +117,15 @@ def check_unsaved_config(): pass def execute_shutdown(time, reboot=True, ask=True): + from vyos.utils.process import cmd + check_unsaved_config() + host = cmd("hostname --fqdn") + action = "reboot" if reboot else "poweroff" if not ask: - if not ask_yes_no(f"Are you sure you want to {action} this system?"): + if not ask_yes_no(f"Are you sure you want to {action} this system ({host})?"): exit(0) action_cmd = "-r" if reboot else "-P" -- cgit v1.2.3