You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by my...@apache.org on 2019/12/16 12:43:36 UTC

[incubator-dlab] branch DLAB-1379 created (now 6e592bf)

This is an automated email from the ASF dual-hosted git repository.

mykolabodnar pushed a change to branch DLAB-1379
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git.


      at 6e592bf  [DLAB-1379] - SSN creation fixed

This branch includes the following new commits:

     new 6e592bf  [DLAB-1379] - SSN creation fixed

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org


[incubator-dlab] 01/01: [DLAB-1379] - SSN creation fixed

Posted by my...@apache.org.
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

commit 6e592bf97c0ea24a03b737209bcb9499c6254948
Author: Mykola_Bodnar1 <bo...@gmail.com>
AuthorDate: Mon Dec 16 14:43:18 2019 +0200

    [DLAB-1379] - SSN creation fixed
---
 .../src/general/lib/gcp/actions_lib.py                        | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
index 02c5f51..0910b71 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
@@ -553,8 +553,9 @@ class GCPActions:
             traceback.print_exc(file=sys.stdout)
 
     def set_role_to_service_account(self, service_account_name, role_name, role_type='custom'):
-        request = GCPActions().service_resource.projects().getIamPolicy(resource=self.project, body={})
-        project_policy = request.execute()
+        resource = "projects/{}/serviceAccounts/{}".format(self.project, service_account_name)
+        request = GCPActions().service_resource.projects().serviceAccounts().getIamPolicy(resource=resource, body={})
+        serviceAccounts_policy = request.execute()
         service_account_email = "{}@{}.iam.gserviceaccount.com".format(service_account_name, self.project)
         params = {
             "role": "projects/{}/roles/{}".format(self.project, role_name.replace('-', '_')),
@@ -564,13 +565,13 @@ class GCPActions:
         }
         if role_type == 'predefined':
             params['role'] = "roles/{}".format(role_name)
-        project_policy['bindings'].append(params)
+        serviceAccounts_policy['bindings'].append(params)
         params = {
             "policy": {
-                "bindings": project_policy['bindings']
+                "bindings": serviceAccounts_policy['bindings']
             }
         }
-        request = self.service_resource.projects().setIamPolicy(resource=self.project, body=params)
+        request = self.service_resource.projects().serviceAccounts().setIamPolicy(resource=resource, body=params)
         try:
             return request.execute()
         except Exception as err:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org