You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by lf...@apache.org on 2020/06/12 08:49:25 UTC
[incubator-dlab] 01/06: [DLAB-54]: added script to terminate custom
notebook image
This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DLAB-54-dev
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 9eab69a1a6752c8b60d130be4e0f3f4ed38dcd92
Author: leonidfrolov <fr...@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-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org