summaryrefslogtreecommitdiff
path: root/src
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:22 +0000
commitfba057252f7db6d0ba49ec8725466492ba01dda9 (patch)
treea5b54efc8f918eeeb6ff22ec70c98d3292bdb5fd /src
parentb71096a815e853430907d6eb5a24dc706bf73c25 (diff)
downloadvyos-1x-fba057252f7db6d0ba49ec8725466492ba01dda9.tar.gz
vyos-1x-fba057252f7db6d0ba49ec8725466492ba01dda9.zip
op-mode: T6537: include hostname in the reboot/shutdown warning message
(cherry picked from commit dc60fe993505d1adca60f9b6e0f47f565c459331)
Diffstat (limited to 'src')
-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"