Skip to content

Commit

Permalink
Removed provision key retry logic as that already happens at hm-diag …
Browse files Browse the repository at this point in the history
…end.
  • Loading branch information
kashifpk committed Aug 27, 2022
1 parent 00d9f62 commit 71820a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
34 changes: 10 additions & 24 deletions hm_pyhelper/miner_param.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import subprocess
import json
from time import sleep
from random import randint
from packaging.version import Version

from retry import retry
Expand Down Expand Up @@ -170,31 +168,19 @@ def provision_key():
if did_gateway_mfr_test_result_include_miner_key_pass(test_results):
return True

provisioning_successful = False
retries = 0
max_retries = 5

while not provisioning_successful:
try:
gateway_mfr_result = run_gateway_mfr(["provision"])
LOGGER.info("[ECC Provisioning] %s", gateway_mfr_result)
provisioning_successful = True
break

except subprocess.CalledProcessError:
LOGGER.error("[ECC Provisioning] Exited with a non-zero status")

except Exception as exp:
LOGGER.error("[ECC Provisioning] Error during provisioning. %s" % str(exp))
try:
gateway_mfr_result = run_gateway_mfr(["provision"])
LOGGER.info("[ECC Provisioning] %s", gateway_mfr_result)

retries += 1
if retries >= max_retries:
break
except subprocess.CalledProcessError:
LOGGER.error("[ECC Provisioning] Exited with a non-zero status")
return False

sleep(randint(1, 5)) # NOSONAR
LOGGER.info("[ECC Provisioning] Retrying ...")
except Exception as exp:
LOGGER.error("[ECC Provisioning] Error during provisioning. %s" % str(exp))
return False

return provisioning_successful
return True


def did_gateway_mfr_test_result_include_miner_key_pass(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='hm_pyhelper',
version='0.13.33',
version='0.13.34',
author="Nebra Ltd",
author_email="[email protected]",
description="Helium Python Helper",
Expand Down

0 comments on commit 71820a9

Please sign in to comment.