Compare commits
10 Commits
92dac6755b
...
07134d26d7
Author | SHA1 | Date |
---|---|---|
|
07134d26d7 | |
|
a60adedafd | |
|
2263d293c8 | |
|
4953ffe965 | |
|
de683b989e | |
|
cfba5d729d | |
|
9a36cf99bf | |
|
90a76735e2 | |
|
b74bb34f40 | |
|
b3502c8778 |
|
@ -249,17 +249,28 @@ async def hive_load_configs(default_power_limits, static_config):
|
||||||
fs_core_lock, fs_mem_lock = extract_last_setcore_setmem(wallet_conf_content)
|
fs_core_lock, fs_mem_lock = extract_last_setcore_setmem(wallet_conf_content)
|
||||||
for wallet_conf_line in wallet_conf_content.split('\n'):
|
for wallet_conf_line in wallet_conf_content.split('\n'):
|
||||||
wallet_conf_line = wallet_conf_line.strip()
|
wallet_conf_line = wallet_conf_line.strip()
|
||||||
logger.info(wallet_conf_line)
|
|
||||||
if wallet_conf_line[:1] != "#" and '=' in wallet_conf_line:
|
if wallet_conf_line[:1] != "#" and '=' in wallet_conf_line:
|
||||||
key, value = [wallet_conf_line.split('=', 1)[0], clean_config_value(wallet_conf_line.split('=', 1)[1])]
|
key, value = [wallet_conf_line.split('=', 1)[0], clean_config_value(wallet_conf_line.split('=', 1)[1])]
|
||||||
logger.info(key)
|
|
||||||
logger.info(value)
|
|
||||||
if key[-9:] == "_TEMPLATE":
|
if key[-9:] == "_TEMPLATE":
|
||||||
possible_clore_config = base64_string_to_json(value)
|
possible_clore_config = base64_string_to_json(value)
|
||||||
if possible_clore_config:
|
if possible_clore_config:
|
||||||
clore_config = possible_clore_config
|
clore_config = possible_clore_config
|
||||||
elif key == "CUSTOM_MINER" and value == "clore":
|
elif key == "CUSTOM_MINER" and value == "clore":
|
||||||
clore_miner_present = True
|
clore_miner_present = True
|
||||||
|
elif key == "CLORE_RENTALS_TOKEN":
|
||||||
|
possible_clore_config = base64_string_to_json(value)
|
||||||
|
if possible_clore_config:
|
||||||
|
clore_config = possible_clore_config
|
||||||
|
elif key == "META":
|
||||||
|
try:
|
||||||
|
meta_value = json.loads(value)
|
||||||
|
if (isinstance(meta_value, dict) and
|
||||||
|
"clore-rentals" in meta_value and
|
||||||
|
isinstance(meta_value["clore-rentals"], dict) and
|
||||||
|
meta_value["clore-rentals"].get("coin") == "CLORE-Rentals"):
|
||||||
|
clore_miner_present = True
|
||||||
|
except (json.JSONDecodeError, TypeError, KeyError) as e:
|
||||||
|
pass
|
||||||
|
|
||||||
if (not clore_miner_present or not clore_config) and parsed_static_config:
|
if (not clore_miner_present or not clore_config) and parsed_static_config:
|
||||||
clore_miner_present = True
|
clore_miner_present = True
|
||||||
|
@ -428,6 +439,7 @@ if args.write_linux_config:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
async def main(machine_specs):
|
async def main(machine_specs):
|
||||||
|
logger.info("Started onboarding")
|
||||||
global next_retry_reached_server_limit
|
global next_retry_reached_server_limit
|
||||||
last_used_config = None
|
last_used_config = None
|
||||||
ever_pending_creation = False
|
ever_pending_creation = False
|
||||||
|
@ -446,6 +458,7 @@ async def main(machine_specs):
|
||||||
oc_config = {}
|
oc_config = {}
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
logger.info("Looping")
|
||||||
if args.mode == "linux":
|
if args.mode == "linux":
|
||||||
clore_config = await async_read_file(clore_conf_path)
|
clore_config = await async_read_file(clore_conf_path)
|
||||||
clore_config = json.loads(clore_config)
|
clore_config = json.loads(clore_config)
|
||||||
|
@ -493,7 +506,7 @@ async def main(machine_specs):
|
||||||
await asyncio.sleep(60 if ever_pending_creation else 10)
|
await asyncio.sleep(60 if ever_pending_creation else 10)
|
||||||
ever_pending_creation = True
|
ever_pending_creation = True
|
||||||
last_used_config = None
|
last_used_config = None
|
||||||
elif "init_communication_token" in response_data and "private_communication_token":
|
elif "init_communication_token" in response_data and "private_communication_token" in response_data:
|
||||||
clore_hosting_sw_auth_str = f"{response_data['init_communication_token']}:{response_data['private_communication_token']}"
|
clore_hosting_sw_auth_str = f"{response_data['init_communication_token']}:{response_data['private_communication_token']}"
|
||||||
was_ok = verify_or_update_file(args.auth_file, clore_hosting_sw_auth_str)
|
was_ok = verify_or_update_file(args.auth_file, clore_hosting_sw_auth_str)
|
||||||
if was_ok:
|
if was_ok:
|
||||||
|
|
Loading…
Reference in New Issue