summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-07-04 13:57:25 +0200
committerGitHub <noreply@github.com>2024-07-04 13:57:25 +0200
commite76b2ae30d08c91bdd595798fb037ce692781ca7 (patch)
tree7c23d5a45fb21354cb00768399abd63850ce3915
parent1f03dbc5fb2952530fa6f9cb45a81d3a905224b6 (diff)
parentfba057252f7db6d0ba49ec8725466492ba01dda9 (diff)
downloadvyos-1x-e76b2ae30d08c91bdd595798fb037ce692781ca7.tar.gz
vyos-1x-e76b2ae30d08c91bdd595798fb037ce692781ca7.zip
Merge pull request #3775 from vyos/mergify/bp/sagitta/pr-3767
op-mode: T6537: include hostname in the reboot/shutdown warning message (backport #3767)
-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"