Skip to content

Commit

Permalink
Merge afcc080 into a60cf4e
Browse files Browse the repository at this point in the history
  • Loading branch information
themarcelor committed Jan 23, 2021
2 parents a60cf4e + afcc080 commit 186cba1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fence/scripting/fence_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ def remove_expired_google_service_account_keys(db):

# handle service accounts with custom expiration
for expired_user_key in expired_sa_keys_for_users:
logger.info("expired_user_key: {}\n".format(expired_user_key))
sa = (
current_session.query(GoogleServiceAccount)
.filter(
Expand All @@ -555,6 +556,9 @@ def remove_expired_google_service_account_keys(db):
account=sa.email, key_name=expired_user_key.key_id
)
response_error_code = response.get("error", {}).get("code")
response_error_status = response.get("error", {}).get("status")
logger.info("response_error_code: {}\n".format(response_error_code))
logger.info("response_error_status: {}\n".format(response_error_status))

if not response_error_code:
current_session.delete(expired_user_key)
Expand All @@ -564,7 +568,10 @@ def remove_expired_google_service_account_keys(db):
expired_user_key.key_id, sa.email, sa.user_id
)
)
elif response_error_code == 404:
elif (
response_error_code == 404
or response_error_status == "FAILED_PRECONDITION"
):
logger.info(
"INFO: Service account key {} for service account {} "
"(owned by user with id {}) does not exist in Google. "
Expand Down

0 comments on commit 186cba1

Please sign in to comment.