This is an automated email from the ASF dual-hosted git repository. mykolabodnar pushed a commit to branch DLAB-1379 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-1379 by this push: new b40190b [DLAB-1379] - SSN creation fixed b40190b is described below commit b40190b1afe67d5b8345557d33cfd3fbf2d7ed5a Author: Mykola_Bodnar1 <bodnarmyk...@gmail.com> AuthorDate: Mon Dec 16 17:21:08 2019 +0200 [DLAB-1379] - SSN creation fixed --- .../src/general/lib/gcp/actions_lib.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py index a312d4e..e3d9f53 100644 --- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py +++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py @@ -555,12 +555,15 @@ class GCPActions: def set_role_to_service_account(self, service_account_name, role_name, role_type='custom'): service_account_email = "{}@{}.iam.gserviceaccount.com".format(service_account_name, self.project) resource = "projects/{}/serviceAccounts/{}".format(self.project, service_account_email) - + if role_type == 'predefined': + role = "roles/{}".format(role_name) + else: + role = "projects/{}/roles/{}".format(self.project, role_name.replace('-', '_')) params = { "policy": { "bindings": [ { - "role": "projects/{}/roles/{}".format(self.project, role_name.replace('-', '_')), + "role": role, "members": [ "serviceAccount:{}".format(service_account_email) ] @@ -568,10 +571,6 @@ class GCPActions: ] } } - if role_type == 'predefined': - params['role'] = "roles/{}".format(role_name) - print('Parameters') - print(params) request = self.service_iam.projects().serviceAccounts().setIamPolicy(resource=resource, body=params) try: return request.execute() --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org