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 9e25270  [DLAB-1379] - SSN creation fixed
9e25270 is described below

commit 9e2527092e966616882f98ffd45ae464a8b00147
Author: Mykola_Bodnar1 <bodnarmyk...@gmail.com>
AuthorDate: Mon Dec 16 17:38:44 2019 +0200

    [DLAB-1379] - SSN creation fixed
---
 .../src/general/lib/gcp/actions_lib.py                     |  5 +----
 .../general/scripts/gcp/common_create_service_account.py   | 14 +++++++-------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py 
b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
index 3828f10..b47b3dd 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
@@ -555,10 +555,7 @@ 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 = "projects/{}/roles/{}".format(self.project, 
role_name.replace('-', '_'))
-        else:
-            role = "projects/{}/roles/{}".format(self.project, 
role_name.replace('-', '_'))
+        role = "projects/{}/roles/{}".format(self.project, 
role_name.replace('-', '_'))
         params =  {
             "policy": {
                 "bindings": [
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/common_create_service_account.py
 
b/infrastructure-provisioning/src/general/scripts/gcp/common_create_service_account.py
index a0f5046..a03dc44 100644
--- 
a/infrastructure-provisioning/src/general/scripts/gcp/common_create_service_account.py
+++ 
b/infrastructure-provisioning/src/general/scripts/gcp/common_create_service_account.py
@@ -58,13 +58,13 @@ if __name__ == "__main__":
                 GCPActions().create_role(args.role_name, permissions)
             print("Assigning custom role to Service account.")
             
GCPActions().set_role_to_service_account(args.service_account_name, 
args.role_name)
-            if args.roles_path != '':
-                print("Assigning predefined roles to Service account.")
-                with open(args.roles_path, 'r') as f:
-                    json_file = f.read()
-                predefined_roles = json.loads(json_file)
-                for role in predefined_roles:
-                    
GCPActions().set_role_to_service_account(args.service_account_name, role, 
'predefined')
+#            if args.roles_path != '':
+#                print("Assigning predefined roles to Service account.")
+#                with open(args.roles_path, 'r') as f:
+#                    json_file = f.read()
+#                predefined_roles = json.loads(json_file)
+#                for role in predefined_roles:
+#                    
GCPActions().set_role_to_service_account(args.service_account_name, role, 
'predefined')
     else:
         parser.print_help()
         sys.exit(2)


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

Reply via email to