use deploy logging context for app creation logs (#952)

This commit is contained in:
bmc-msft
2021-06-02 12:15:47 -04:00
committed by GitHub
parent 60ae07c34f
commit 3d191c3c5d
2 changed files with 6 additions and 6 deletions

View File

@ -347,7 +347,7 @@ class Client:
not in str(err) not in str(err)
): ):
raise err raise err
logging.warning( logger.warning(
"creating service principal failed with an error that occurs " "creating service principal failed with an error that occurs "
"due to AAD race conditions" "due to AAD race conditions"
) )
@ -533,7 +533,7 @@ class Client:
"PrincipalNotFound" in as_repr "PrincipalNotFound" in as_repr
and "does not exist in the directory" in as_repr and "does not exist in the directory" in as_repr
): ):
logging.info("application principal not available in AAD yet") logger.info("application principal not available in AAD yet")
if error: if error:
raise error raise error
else: else:

View File

@ -252,10 +252,10 @@ def add_application_password(
while count < tries: while count < tries:
count += 1 count += 1
if count > 1: if count > 1:
logging.info("retrying app password creation") logger.info("retrying app password creation")
try: try:
password = add_application_password_impl(app_object_id, subscription_id) password = add_application_password_impl(app_object_id, subscription_id)
logging.info("app password created") logger.info("app password created")
return password return password
except GraphQueryError as err: except GraphQueryError as err:
error = err error = err
@ -265,9 +265,9 @@ def add_application_password(
# azure/cli/command_modules/util/tests/ # azure/cli/command_modules/util/tests/
# latest/test_rest.py#L191-L192 # latest/test_rest.py#L191-L192
if "Request_ResourceNotFound" in repr(err): if "Request_ResourceNotFound" in repr(err):
logging.info("app unavailable in AAD, unable to create password yet") logger.info("app unavailable in AAD, unable to create password yet")
else: else:
logging.warning("unable to create app password: %s", err.message) logger.warning("unable to create app password: %s", err.message)
time.sleep(wait_duration) time.sleep(wait_duration)
if error: if error:
raise error raise error