From ec3aab5f25d01d0489713b133164256245dad02d Mon Sep 17 00:00:00 2001 From: David Heiman Date: Wed, 12 Jun 2019 13:38:51 -0400 Subject: [PATCH] Corrected Google Cloud VM error: (#125) On Google Cloud VMs, the user's account email is stored in a different attribute of the Session's Credentials object (service_account_email rather than id_token). The existence of the attributes are also mutually exclusive. This caused an AttributeError when accessing a non-existent attribute, and failure to populate __USER_ID, which broke several functions. Updated api.py to handle the different attribute locations. --- changelog.txt | 4 ++++ firecloud/__about__.py | 2 +- firecloud/api.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 081cc81..3b7b255 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,10 @@ Change Log for FISSFC: the (Fi)recloud (S)ervice (S)elector ======================================================================= Terms used below: HL = high level interface, LL = low level interface +v0.16.24 - Hotfix: corrected error in api.py due to difference in user ID + location when run from a Google Cloud VM; setup.py updated to + explicitly designate long_description_content_type as text/plain. + v0.16.23 - LL: get_entities_tsv updated with ability to specify ordered attributes and data model, upload_entities and upload_entities_tsv updated to enable use of flexible data model API; HL: added back diff --git a/firecloud/__about__.py b/firecloud/__about__.py index 057f88f..15dc7db 100644 --- a/firecloud/__about__.py +++ b/firecloud/__about__.py @@ -1,2 +1,2 @@ # Package version -__version__ = "0.16.23" +__version__ = "0.16.24" diff --git a/firecloud/api.py b/firecloud/api.py index d60ffb8..9dea4bd 100755 --- a/firecloud/api.py +++ b/firecloud/api.py @@ -52,6 +52,8 @@ def _set_session(): health() __USER_ID = id_token.verify_oauth2_token(__SESSION.credentials.id_token, Request(session=__SESSION))['email'] + except AttributeError: + __USER_ID = __SESSION.credentials.service_account_email except (DefaultCredentialsError, RefreshError) as gae: if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine/'): raise