Skip to content

Commit

Permalink
fix(conflict): correctly construct existing SA email (#53)
Browse files Browse the repository at this point in the history
* fix(conflict): correctly construct existing SA email

* chore(deps): jenkins failing. needs latest version of pytest
  • Loading branch information
Avantol13 authored Jan 25, 2019
1 parent f67cec6 commit 574936d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions cirrus/google_cloud/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
GoogleAPIError,
GoogleNamingError,
)
from cirrus.google_cloud.iam import GooglePolicy
from cirrus.google_cloud.iam import GooglePolicyBinding
from cirrus.google_cloud.iam import GooglePolicyMember
from cirrus.google_cloud.iam import GooglePolicyRole
from cirrus.google_cloud.iam import (
GooglePolicy,
GooglePolicyBinding,
GooglePolicyMember,
GooglePolicyRole,
get_iam_service_account_email,
)
from cirrus.google_cloud.services import GoogleAdminService
from cirrus.google_cloud.utils import get_valid_service_account_id_for_user

Expand Down Expand Up @@ -722,7 +725,10 @@ def create_service_account(self, account_id):
if err.resp.status == 409:
# conflict, sa already exists. This is fine, don't raise an
# error, pass back sa
return self.get_service_account(account_id)
account_email = get_iam_service_account_email(
self.project_id, account_id
)
return self.get_service_account(account_email)

raise

Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mock==2.0.0
pytest
pytest>=3.6
pytest-cov
codacy-coverage
Sphinx==1.6.5

0 comments on commit 574936d

Please sign in to comment.