1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-13 17:17:23 +01:00

move the reboot button, fix grammar, refactor check for DRY, add changelog entry

This commit is contained in:
Joshua Tauberer
2016-03-23 16:37:15 -04:00
parent b71ad85e9f
commit 67555679bd
4 changed files with 36 additions and 22 deletions

View File

@@ -456,10 +456,12 @@ def do_updates():
"DEBIAN_FRONTEND": "noninteractive"
})
@app.route('/system/reboot', methods=["GET"])
@authorized_personnel_only
def needs_reboot():
if os.path.isfile("/var/run/reboot-required"):
from status_checks import is_reboot_needed_due_to_package_installation
if is_reboot_needed_due_to_package_installation():
return json_response(True)
else:
return json_response(False)
@@ -467,10 +469,12 @@ def needs_reboot():
@app.route('/system/reboot', methods=["POST"])
@authorized_personnel_only
def do_reboot():
if os.path.isfile("/var/run/reboot-required"):
# To keep the attack surface low, we don't allow a remote reboot if one isn't necessary.
from status_checks import is_reboot_needed_due_to_package_installation
if is_reboot_needed_due_to_package_installation():
return utils.shell("check_output", ["/sbin/shutdown", "-r", "now"], capture_stderr=True)
else:
return "No reboot is required"
return "No reboot is required, so it is not allowed."
@app.route('/system/backup/status')