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 0b6a4ccd5e1e383affcf27cc4ba9518638605051 Author: leonidfrolov <frolovl...@gmail.com> AuthorDate: Tue Jun 9 15:32:11 2020 +0300 [DLAB-54]: added script to terminate custom notebook image --- .../scripts/gcp/common_terminate_notebook_image.py | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) 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 new file mode 100644 index 0000000..94d75d5 --- /dev/null +++ b/infrastructure-provisioning/src/general/scripts/gcp/common_terminate_notebook_image.py @@ -0,0 +1,47 @@ +#!/usr/bin/python + +# ***************************************************************************** +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# ****************************************************************************** + +import dlab.fab +import dlab.actions_lib +import dlab.meta_lib +import sys +import json +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) + with open("/root/result.json", 'w') as result: + res = {"notebook_image_name": image_conf['full_image_name'], + "status": "terminated", + "Action": "Delete existing notebook image"} + result.write(json.dumps(res)) + + except Exception as err: + dlab.fab.append_result("Failed to delete existing notebook image", str(err)) + sys.exit(1) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org