Skip to content
Snippets Groups Projects
Commit d3098370 authored by Jake Taylor's avatar Jake Taylor :lips:
Browse files

Merge branch 'hotfix/NetworkSettings' into 'release'

fix checking network settings on startup

See merge request !8
parents 5f13bc81 387fc1c7
No related branches found
No related tags found
2 merge requests!10Release,!8fix checking network settings on startup
...@@ -29,7 +29,6 @@ from OpenSSL import crypto ...@@ -29,7 +29,6 @@ from OpenSSL import crypto
from substrateinterface import SubstrateInterface from substrateinterface import SubstrateInterface
import hashlib import hashlib
######################################################################################################################## ########################################################################################################################
# Blockchain Updates # Blockchain Updates
######################################################################################################################## ########################################################################################################################
...@@ -145,7 +144,8 @@ def poll_ready(substrate): ...@@ -145,7 +144,8 @@ def poll_ready(substrate):
params=[era, val] params=[era, val]
) )
except Exception as e: except Exception as e:
log.error(f"Connection lost while in \'substrate.query(\"Staking\", \"ErasValidatorPrefs\", [{era}, {val}])\'. Error: %s" % e) log.error(
f"Connection lost while in \'substrate.query(\"Staking\", \"ErasValidatorPrefs\", [{era}, {val}])\'. Error: %s" % e)
return return
cmix_root = data.value['cmix_root'] cmix_root = data.value['cmix_root']
...@@ -827,6 +827,11 @@ def main(): ...@@ -827,6 +827,11 @@ def main():
disable_consensus = args["disable_consensus"] disable_consensus = args["disable_consensus"]
disable_cloudwatch = args["disable_cloudwatch"] disable_cloudwatch = args["disable_cloudwatch"]
# Ensure network settings are properly configured before allowing a start
if not check_networking():
raise Exception("Unacceptable network settings, refusing to start. "
"Run the suggested commands and restart the wrapper service.")
# The valid "install" paths we can write to, with their local paths for # The valid "install" paths we can write to, with their local paths for
# this machine # this machine
valid_paths = { valid_paths = {
...@@ -837,9 +842,6 @@ def main(): ...@@ -837,9 +842,6 @@ def main():
Targets.CERT: rsa_certificate_path, Targets.CERT: rsa_certificate_path,
} }
# Record the most recent command timestamp
# to avoid executing duplicate commands
timestamps = [0, time.time()]
# Record the most recent error timestamp to avoid restart loops # Record the most recent error timestamp to avoid restart loops
last_error_timestamp = 0 last_error_timestamp = 0
# Frequency (in seconds) of checking for new commands # Frequency (in seconds) of checking for new commands
...@@ -992,7 +994,8 @@ def main(): ...@@ -992,7 +994,8 @@ def main():
current_hash = current_hashes.get( current_hash = current_hashes.get(
management_directory, "0000000000000000000000000000000000000000000000000000000000000000") management_directory, "0000000000000000000000000000000000000000000000000000000000000000")
if new_hash != current_hash: if new_hash != current_hash:
log.info("{} update required: {} -> {}".format(management_directory, current_hash, new_hash)) log.info(
"{} update required: {} -> {}".format(management_directory, current_hash, new_hash))
# Stop the process # Stop the process
terminate_process(process) terminate_process(process)
# Get local destination path # Get local destination path
...@@ -1091,14 +1094,6 @@ def main(): ...@@ -1091,14 +1094,6 @@ def main():
# START COMMAND =========================== # START COMMAND ===========================
if command_type == "start": if command_type == "start":
# Ensure network settings are properly configured before allowing a start
if not check_networking():
log.error("Unacceptable network settings, refusing to start. "
"Run the suggested commands")
timestamps[i] = timestamp
continue
# Decide which type of binary to start # Decide which type of binary to start
if target == Targets.BINARY and (process is None or process.poll() is not None): if target == Targets.BINARY and (process is None or process.poll() is not None):
process = start_binary(valid_paths[Targets.BINARY], log_path, process = start_binary(valid_paths[Targets.BINARY], log_path,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment