Add log to upgrade page
This commit is contained in:
parent
fc3ee4f62d
commit
6ea18606c9
|
@ -59,15 +59,16 @@ sleep 1
|
|||
sync
|
||||
sleep 1
|
||||
|
||||
# Run post upgrade script
|
||||
VERSION=$(cat /usr/share/mynode/version)
|
||||
|
||||
# Clear old upgrade logs
|
||||
rm -f /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_*
|
||||
rm -f /home/admin/upgrade_logs/upgrade_log_latest_post_*
|
||||
|
||||
# Run post upgrade script
|
||||
touch $UPGRADE_ERROR_FILE
|
||||
for i in {1..5}
|
||||
do
|
||||
# Clear old upgrade logs
|
||||
rm -f /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_*
|
||||
rm -f /home/admin/upgrade_logs/upgrade_log_latest_post_*
|
||||
|
||||
/bin/bash /usr/bin/mynode_post_upgrade.sh 2>&1 | tee /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_${i}.txt /home/admin/upgrade_logs/upgrade_log_latest_post_${i}.txt
|
||||
RC=$?
|
||||
if [ "${RC}" -eq "0" ]; then
|
||||
|
|
|
@ -298,6 +298,7 @@ def upgrade_page():
|
|||
"title": "myNode Upgrade",
|
||||
"header_text": "Upgrading",
|
||||
"subheader_text": "This may take a while...",
|
||||
"show_upgrade_log": True,
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
@ -317,11 +318,12 @@ def upgrade_beta_page():
|
|||
"title": "myNode Upgrade",
|
||||
"header_text": "Upgrading",
|
||||
"subheader_text": "This may take a while...",
|
||||
"show_upgrade_log": True,
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
@mynode_settings.route("/settings/get-upgrade-log")
|
||||
@mynode_settings.route("/settings/get-upgrade-log-raw")
|
||||
def get_upgrade_log_page():
|
||||
check_logged_in()
|
||||
|
||||
|
@ -331,6 +333,20 @@ def get_upgrade_log_page():
|
|||
|
||||
return log
|
||||
|
||||
@mynode_settings.route("/settings/upgrade-test")
|
||||
def upgrade_page_test():
|
||||
check_logged_in()
|
||||
|
||||
# Display wait page
|
||||
templateData = {
|
||||
"title": "myNode Upgrade",
|
||||
"header_text": "Upgrading",
|
||||
"subheader_text": "This may take a while...",
|
||||
"show_upgrade_log": True,
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
@mynode_settings.route("/settings/get-latest-version")
|
||||
def get_latest_version_page():
|
||||
check_logged_in()
|
||||
|
|
|
@ -31,6 +31,29 @@
|
|||
|
||||
checkStatus()
|
||||
setInterval(checkStatus, 2500);
|
||||
|
||||
{% if show_upgrade_log is defined and show_upgrade_log %}
|
||||
function update_upgrade_log () {
|
||||
console.log("Updating upgrade log...");
|
||||
$.get("/settings/get-upgrade-log-raw", function(data) {
|
||||
//console.log(data)
|
||||
data = data.split("\n");
|
||||
data.reverse();
|
||||
log = data.join("\n")
|
||||
console.log("Displaying " + data.length + " lines")
|
||||
$("#upgrade_log_contents").html(log)
|
||||
});
|
||||
}
|
||||
$("#show_upgrade_log").on("click", function() {
|
||||
$("#show_upgrade_log").hide(0);
|
||||
$("#loading_spinner").hide(0);
|
||||
|
||||
update_upgrade_log()
|
||||
setInterval(update_upgrade_log, 4000);
|
||||
|
||||
$("#upgrade_log").show();
|
||||
});
|
||||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -46,8 +69,16 @@
|
|||
<br/>
|
||||
<p class="shutoff_warning">please do not power off or unplug device</p>
|
||||
|
||||
<br/>
|
||||
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
|
||||
<br/><br/>
|
||||
<img class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
|
||||
|
||||
{% if show_upgrade_log is defined and show_upgrade_log %}
|
||||
<button id="show_upgrade_log" class="ui-button ui-widget ui-corner-all settings_button_small">Show Upgrade Log</button>
|
||||
<div class="cli_contents" id="upgrade_log" style="display: none; height: 300px; max-height: 300px;">
|
||||
<pre id="upgrade_log_contents" style="text-align: left; font-size: 10px;"></pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue
Block a user