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
Branches
No related tags found
2 merge requests!10Release,!8fix checking network settings on startup
......@@ -29,7 +29,6 @@ from OpenSSL import crypto
from substrateinterface import SubstrateInterface
import hashlib
########################################################################################################################
# Blockchain Updates
########################################################################################################################
......@@ -145,7 +144,8 @@ def poll_ready(substrate):
params=[era, val]
)
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
cmix_root = data.value['cmix_root']
......@@ -827,6 +827,11 @@ def main():
disable_consensus = args["disable_consensus"]
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
# this machine
valid_paths = {
......@@ -837,9 +842,6 @@ def main():
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
last_error_timestamp = 0
# Frequency (in seconds) of checking for new commands
......@@ -992,7 +994,8 @@ def main():
current_hash = current_hashes.get(
management_directory, "0000000000000000000000000000000000000000000000000000000000000000")
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
terminate_process(process)
# Get local destination path
......@@ -1091,14 +1094,6 @@ def main():
# START COMMAND ===========================
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
if target == Targets.BINARY and (process is None or process.poll() is not None):
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