Skip to content

Commit 2977bc8

Browse files
markmirchbusunkim96Ace Nassricrwilcox
authored
Adding error condition to billing check (GoogleCloudPlatform#4272)
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Ace Nassri <anassri@google.com> Co-authored-by: Christopher Wilcox <crwilcox@google.com>
1 parent d5c2635 commit 2977bc8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

functions/billing/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def __is_billing_enabled(project_name, projects):
104104
try:
105105
res = projects.getBillingInfo(name=project_name).execute()
106106
return res['billingEnabled']
107+
except KeyError:
108+
# If billingEnabled isn't part of the return, billing is not enabled
109+
return False
107110
except Exception:
108111
print('Unable to determine if billing is enabled on specified project, assuming billing is enabled')
109112
return True

0 commit comments

Comments
 (0)