This is an automated email from the ASF dual-hosted git repository.
omartushevskyi pushed a commit to branch DLAB-1546
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-1546 by this push:
new 538862f [DLAB-1546]: added name convention changes
538862f is described below
commit 538862f49ffc459ecf74801e304690c454a15a1f
Author: Oleh Martushevskyi <[email protected]>
AuthorDate: Thu Mar 5 12:31:12 2020 +0200
[DLAB-1546]: added name convention changes
---
infrastructure-provisioning/src/general/lib/aws/actions_lib.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
index c0a5842..018969b 100644
--- a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
@@ -891,10 +891,14 @@ def remove_roles_and_profiles(role_name,
role_profile_name):
def remove_all_iam_resources(instance_type, scientist=''):
try:
client = boto3.client('iam')
- service_base_name = os.environ['conf_service_base_name'].lower()
+ service_base_name = os.environ['conf_service_base_name']
roles_list = []
+ if scientist:
+ start_prefix = '{}-{}-'.format(service_base_name, scientist)
+ else:
+ start_prefix = '{}-'.format(service_base_name)
for item in client.list_roles(MaxItems=250).get("Roles"):
- if item.get("RoleName").startswith(service_base_name + '-'):
+ if item.get("RoleName").startswith(start_prefix):
roles_list.append(item.get('RoleName'))
if roles_list:
roles_list.sort(reverse=True)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]