summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-07-03 22:13:57 +0200
committerGitHub <noreply@github.com>2024-07-03 22:13:57 +0200
commit63c596cf11b8d738cec3e8a0b290ca20f61a122f (patch)
tree59fae66f048c94d28765e66db3e1a6be5c5b4103
parent2eb80002145bbd4b4d965b14ba401378b45bfc80 (diff)
parentdc60fe993505d1adca60f9b6e0f47f565c459331 (diff)
downloadvyos-1x-63c596cf11b8d738cec3e8a0b290ca20f61a122f.tar.gz
vyos-1x-63c596cf11b8d738cec3e8a0b290ca20f61a122f.zip
Merge pull request #3767 from dmbaturin/T6537-reboot-prompt-hostname
op-mode: T6537: include hostname in the reboot/shutdown warning message
-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"