This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a change to branch DLAB-1643
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git.
at f704965 [DLAB-1643]: made some changes
This branch includes the following new commits:
new a8c09c6 [DLAB-1643]: changed SA and roles termination during project termination
new f704965 [DLAB-1643]: made some changes
The 2 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
This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DLAB-1643
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit a8c09c6b45dc3ae5347027a3a5c31a6bc51bdfdb
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Thu Mar 19 12:26:25 2020 +0200
[DLAB-1643]: changed SA and roles termination during project termination
---
.../src/general/scripts/gcp/project_terminate.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py b/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py
index 0f5b5bf..49d0767 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py
@@ -53,7 +53,7 @@ def terminate_edge_node(endpoint_name, project_name, service_base_name, region,
print("Terminating EDGE and notebook instances")
base = '{}-{}-{}'.format(service_base_name, project_name, endpoint_name)
- keys = ['edge', 'ps', 'static-ip', 'bucket', 'subnet']
+ keys = ['edge', 'ps', 'static-ip', 'bucket', 'subnet', 'edge-sa', 'ps-sa', 'edge-role', 'ps-role']
targets = ['{}-{}'.format(base, k) for k in keys]
try:
instances = GCPMeta.get_list_instances(zone, base)
@@ -104,14 +104,10 @@ def terminate_edge_node(endpoint_name, project_name, service_base_name, region,
role_targets = ['{}-{}-{}'.format(base, GCPMeta.get_index_by_service_account_name(
'{}-{}'.format(base, k)), k) for k in keys]
for service_account in (set(targets) & set(list_service_accounts)):
- if service_account.startswith(service_base_name) and service_account.endswith('-edge-sa'):
- GCPActions.remove_service_account(service_account, service_base_name)
- elif service_account.startswith(service_base_name) and service_account.endswith('-ps-sa'):
- GCPActions.remove_service_account(service_account, service_base_name)
+ GCPActions.remove_service_account(service_account, service_base_name)
list_roles_names = GCPMeta.get_list_roles()
for role in (set(role_targets) & set(list_roles_names)):
- if role.startswith(service_base_name):
- GCPActions.remove_role(role)
+ GCPActions.remove_role(role)
except Exception as err:
dlab.fab.append_result("Failed to remove service accounts and roles", str(err))
sys.exit(1)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org
This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DLAB-1643
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit f7049651849ca27676b0283abbd4c32d4f6ba821
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Thu Mar 19 15:49:39 2020 +0200
[DLAB-1643]: made some changes
---
.../src/general/scripts/gcp/project_terminate.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py b/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py
index 49d0767..f58b14e 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/project_terminate.py
@@ -53,7 +53,7 @@ def terminate_edge_node(endpoint_name, project_name, service_base_name, region,
print("Terminating EDGE and notebook instances")
base = '{}-{}-{}'.format(service_base_name, project_name, endpoint_name)
- keys = ['edge', 'ps', 'static-ip', 'bucket', 'subnet', 'edge-sa', 'ps-sa', 'edge-role', 'ps-role']
+ keys = ['edge', 'ps', 'static-ip', 'bucket', 'subnet']
targets = ['{}-{}'.format(base, k) for k in keys]
try:
instances = GCPMeta.get_list_instances(zone, base)
@@ -101,8 +101,10 @@ def terminate_edge_node(endpoint_name, project_name, service_base_name, region,
print("Removing Service accounts and roles")
try:
list_service_accounts = GCPMeta.get_list_service_accounts()
- role_targets = ['{}-{}-{}'.format(base, GCPMeta.get_index_by_service_account_name(
- '{}-{}'.format(base, k)), k) for k in keys]
+ sa_keys = ['edge-sa', 'ps-sa']
+ role_keys = ['edge-role', 'ps-role']
+ indexes = [GCPMeta.get_index_by_service_account_name('{}-{}'.format(base, k)) for k in sa_keys]
+ role_targets = ['{}-{}-{}'.format(base, i, k) for k in role_keys for i in indexes]
for service_account in (set(targets) & set(list_service_accounts)):
GCPActions.remove_service_account(service_account, service_base_name)
list_roles_names = GCPMeta.get_list_roles()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org