Re-enable the retry logic for App Password creation (#338)

This commit is contained in:
bmc-msft
2020-11-24 08:00:31 -05:00
committed by GitHub
parent d47124fe8c
commit 905dc7c0d6
3 changed files with 39 additions and 28 deletions

View File

@ -226,19 +226,7 @@ class Client:
sys.exit(1)
def create_password(self, object_id: UUID) -> Tuple[str, str]:
# Work-around the race condition where the app is created but passwords cannot
# be created yet.
count = 0
wait = 5
timeout_seconds = 60
while True:
time.sleep(wait)
count += 1
password = add_application_password(object_id)
if password:
return password
if count > timeout_seconds / wait:
raise Exception("creating password failed, trying again")
return add_application_password(object_id)
def setup_rbac(self) -> None:
"""
@ -689,7 +677,8 @@ class Client:
if i + 1 < max_tries:
logger.debug("func failure error: %s", err)
logger.warning(
"function failed to deploy, waiting 60 seconds and trying again"
"function failed to deploy, waiting 60 "
"seconds and trying again"
)
time.sleep(60)
if error is not None: