Skip to content

Commit

Permalink
Merge pull request #175 from sosimon/bugfix/precondition_keyerror
Browse files Browse the repository at this point in the history
fix KeyError when billing permission requirements are unsatisfied
  • Loading branch information
aaron-lane authored Apr 1, 2019
2 parents e2febd7 + aed9cb7 commit 8949175
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,13 @@ def validate(self, credentials):
request = service.billingAccounts().testIamPermissions(
resource=resource,
body=body)
try:
response = request.execute()
except errors.HttpError:
response = {"permissions": []}
response = request.execute()

req = Requirements(
"Service account permissions on billing account",
resource,
self.REQUIRED_PERMISSIONS,
response["permissions"],
response.get("permissions", []),
)

return req.asdict()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/shared_vpc_no_subnets/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name: shared_vpc_no_subnets
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
version: ~> 0.9.0
tag: v0.10.0
attributes:
- name: project_id
required: true
Expand Down

0 comments on commit 8949175

Please sign in to comment.