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

omartushevskyi pushed a commit to branch DLAB-597-fix
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 404eb3c27a6524cefcd47256536b4c28a6078d29
Author: Oleh Martushevskyi <oleh_martushevs...@epam.com>
AuthorDate: Tue Apr 9 17:26:26 2019 +0300

    [DLAB-597]: Fixed issue with getting list of Service Accounts
---
 infrastructure-provisioning/src/general/lib/gcp/meta_lib.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py 
b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
index b122245..fa8b5a2 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
@@ -332,10 +332,13 @@ class GCPMeta:
             while next_page:
                 result2 = 
self.service_iam.projects().serviceAccounts().list(name='projects/{}'.format(self.project),
                                                                              
pageToken=page_token).execute()
-                for account in result2['accounts']:
-                    service_account_names.append(account['displayName'])
-                if 'nextPageToken' in result2:
-                    page_token = result2['nextPageToken']
+                if result2:
+                    for account in result2['accounts']:
+                        service_account_names.append(account['displayName'])
+                    if 'nextPageToken' in result2:
+                        page_token = result2['nextPageToken']
+                    else:
+                        next_page = False
                 else:
                     next_page = False
             return service_account_names


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

Reply via email to