summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2024-07-03 18:37:33 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-07-03 20:15:21 +0000
commite0d59b95dde474ce7ccc6c5eaf28196456241d67 (patch)
treefe2ad64f7f970dbf75939d9b460a279a09107e39
parente4e32d9a2d9f9085524e9408561717e0f0b821a5 (diff)
downloadvyos-1x-e0d59b95dde474ce7ccc6c5eaf28196456241d67.tar.gz
vyos-1x-e0d59b95dde474ce7ccc6c5eaf28196456241d67.zip
op-mode: T6537: include hostname in the reboot/shutdown warning message
(cherry picked from commit dc60fe993505d1adca60f9b6e0f47f565c459331)
-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"