This is an automated email from the ASF dual-hosted git repository. lfrolov pushed a commit to branch DLAB-54 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit d33f794ef64f1867db80726c6608c0bb678bab12 Author: leonidfrolov <frolovl...@gmail.com> AuthorDate: Tue Jun 9 16:00:49 2020 +0300 [DLAB-54]: changed to terminate both primary and secondary images --- .../scripts/gcp/common_terminate_notebook_image.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/infrastructure-provisioning/src/general/scripts/gcp/common_terminate_notebook_image.py b/infrastructure-provisioning/src/general/scripts/gcp/common_terminate_notebook_image.py index 94d75d5..373a426 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/common_terminate_notebook_image.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/common_terminate_notebook_image.py @@ -32,10 +32,23 @@ import os if __name__ == "__main__": try: image_conf = dict() - image_conf['full_image_name'] = os.environ['notebook_image_name'] - image = dlab.meta_lib.GCPMeta.get_list_images(image_conf['full_image_name']) - if image != '': - dlab.actions_lib.GCPActions.remove_image(image) + image_conf['image_name'] = os.environ['notebook_image_name'] + image_conf['service_base_name'] = os.environ['conf_service_base_name'] = dlab.fab.replace_multi_symbols( + os.environ['conf_service_base_name'][:20], '-', True) + image_conf['endpoint_name'] = (os.environ['endpoint_name']).replace('_', '-').lower() + image_conf['endpoint_tag'] = image_conf['endpoint_name'] + image_conf['project_name'] = os.environ['project_name'] + image_conf['project_tag'] = os.environ['project_name'] + image_conf['expected_primary_image_name'] = '{}-{}-{}-{}-primary-{}'.format( + image_conf['service_base_name'], image_conf['project_name'], image_conf['endpoint_name'], + os.environ['application'], image_conf['image_name']) + image_conf['expected_secondary_image_name'] = '{}-{}-{}-{}-secondary-{}'.format( + image_conf['service_base_name'], image_conf['project_name'], image_conf['endpoint_name'], + os.environ['application'], image_conf['image_name']) + primary_image_id = dlab.meta_lib.GCPMeta.get_image_by_name(image_conf['expected_primary_image_name']) + if primary_image_id != '': + dlab.actions_lib.GCPActions.remove_image(notebook_config['expected_primary_image_name']) + dlab.actions_lib.GCPActions.remove_image(notebook_config['expected_secondary_image_name']) with open("/root/result.json", 'w') as result: res = {"notebook_image_name": image_conf['full_image_name'], "status": "terminated", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org