summaryrefslogtreecommitdiff
path: root/src/op_mode/powerctrl.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2024-07-03 18:37:33 +0100
committerDaniil Baturin <daniil@baturin.org>2024-07-03 18:37:33 +0100
commitdc60fe993505d1adca60f9b6e0f47f565c459331 (patch)
treea198ef9e3c5ba48b4a407de72a7fa47a9a70e98f /src/op_mode/powerctrl.py
parentf01423cdf32be5ce5344c00d570c80bdbce6eda9 (diff)
downloadvyos-1x-dc60fe993505d1adca60f9b6e0f47f565c459331.tar.gz
vyos-1x-dc60fe993505d1adca60f9b6e0f47f565c459331.zip
op-mode: T6537: include hostname in the reboot/shutdown warning message
Diffstat (limited to 'src/op_mode/powerctrl.py')
-rwxr-xr-xsrc/op_mode/powerctrl.py6
1 files changed, 5 insertions, 1 deletions
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"