Add status for failure to contact mynode

This commit is contained in:
Taylor Helsper 2020-07-22 21:28:07 -05:00
parent 91bd5d02a7
commit bff249ccfc
5 changed files with 20 additions and 1 deletions

View File

@ -196,6 +196,9 @@ def get_recent_upgrade_logs():
pass
return logs
def has_checkin_error():
return os.path.isfile("/tmp/check_in_error")
#==================================
# Reseller Info
#==================================

View File

@ -84,6 +84,7 @@ def page_settings():
"latest_version": latest_version,
"current_beta_version": current_beta_version,
"latest_beta_version": latest_beta_version,
"has_checkin_error": has_checkin_error(),
"upgrade_error": did_upgrade_fail(),
"upgrade_logs": get_recent_upgrade_logs(),
"serial_number": serial_number,
@ -187,6 +188,7 @@ def page_status():
"latest_version": latest_version,
"current_beta_version": current_beta_version,
"latest_beta_version": latest_beta_version,
"has_checkin_error": has_checkin_error(),
"upgrade_error": did_upgrade_fail(),
"upgrade_logs": get_recent_upgrade_logs(),
"serial_number": serial_number,

View File

@ -453,6 +453,12 @@
<td>Local IP</td>
<td style="padding-left: 20px;">{{local_ip}}</td>
</tr>
{% if has_checkin_error %}
<tr>
<td>Server</td>
<td style="padding-left: 20px; color: red;"><b>Error contacting mynodebtc.com via Tor!</b><br/>You may have issues checking for new versions or saving product keys.</td>
</tr>
{% endif %}
</table>
<div class="divider"></div>

View File

@ -183,6 +183,12 @@
<td>Local IP</td>
<td style="padding-left: 20px;">{{local_ip}}</td>
</tr>
{% if has_checkin_error %}
<tr>
<td>Server</td>
<td style="padding-left: 20px; color: red;"><b>Error contacting mynodebtc.com via Tor!</b><br/>You may have issues checking for new versions or saving product keys.</td>
</tr>
{% endif %}
</table>
<div class="divider"></div>

View File

@ -190,6 +190,7 @@ def check_in():
os.system("echo '{}' > /home/bitcoin/.mynode/.product_key_error".format(r.text))
os.system("printf \"%s | Check In Returned Error: {} \\n\" \"$(date)\" >> /tmp/check_in_status".format(r.text))
os.system("rm -f /tmp/check_in_error")
check_in_success = True
else:
os.system("printf \"%s | Check In Failed. Retrying... Code {} \\n\" \"$(date)\" >> /tmp/check_in_status".format(r.status_code))
@ -198,6 +199,7 @@ def check_in():
if not check_in_success:
# Check in failed, try again in 2 minutes
os.system("touch /tmp/check_in_error")
time.sleep(120)
return True