summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-07-04 09:42:06 +0200
committerGitHub <noreply@github.com>2024-07-04 09:42:06 +0200
commit18f6159536d67c8fdabf02fe1aa8b4e0e94986d8 (patch)
tree55f737da7e99c63e1ffdbe74c5dc8fe5714230a8 /src/op_mode
parent491252e4abb38215b24f228df189837f3a96a29c (diff)
parente0d59b95dde474ce7ccc6c5eaf28196456241d67 (diff)
downloadvyos-1x-18f6159536d67c8fdabf02fe1aa8b4e0e94986d8.tar.gz
vyos-1x-18f6159536d67c8fdabf02fe1aa8b4e0e94986d8.zip
Merge pull request #3774 from vyos/mergify/bp/circinus/pr-3767
op-mode: T6537: include hostname in the reboot/shutdown warning message (backport #3767)
Diffstat (limited to 'src/op_mode')
-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"