Detach all devices when shutting down/restarting (#323)

* Detach all before shutting down / restarting

* Additional message
This commit is contained in:
Daniel Markstedt 2021-10-13 17:55:25 -07:00 committed by GitHub
parent fa12f49078
commit 9bd0b9802b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -448,20 +448,26 @@ def device_info():
@app.route("/pi/reboot", methods=["POST"])
def restart():
flash("Restarting the Pi momentarily...")
detach_all()
flash("Safely detached all devices.")
flash("Rebooting the Pi momentarily...")
reboot_pi()
return redirect(url_for("index"))
@app.route("/rascsi/restart", methods=["POST"])
def rascsi_restart():
rascsi_service("restart")
detach_all()
flash("Safely detached all devices.")
flash("Restarting RaSCSI Service...")
rascsi_service("restart")
return redirect(url_for("index"))
@app.route("/pi/shutdown", methods=["POST"])
def shutdown():
detach_all()
flash("Safely detached all devices.")
flash("Shutting down the Pi momentarily...")
shutdown_pi()
return redirect(url_for("index"))