You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by om...@apache.org on 2019/12/11 10:08:09 UTC

[incubator-dlab] branch DLAB-1158 updated: added destroying helm_charts

This is an automated email from the ASF dual-hosted git repository.

omartushevskyi pushed a commit to branch DLAB-1158
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1158 by this push:
     new d4b76a3  added destroying helm_charts
d4b76a3 is described below

commit d4b76a3d0041dc2d4efe53d5aca41486b650e6cc
Author: Oleh Martushevskyi <Ol...@epam.com>
AuthorDate: Wed Dec 11 12:07:51 2019 +0200

    added destroying helm_charts
---
 infrastructure-provisioning/terraform/bin/dlab.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/infrastructure-provisioning/terraform/bin/dlab.py b/infrastructure-provisioning/terraform/bin/dlab.py
index 59d6481..cda3f6b 100644
--- a/infrastructure-provisioning/terraform/bin/dlab.py
+++ b/infrastructure-provisioning/terraform/bin/dlab.py
@@ -850,6 +850,18 @@ class AWSK8sSourceBuilder(AbstractDeployBuilder):
             else:
                 break
 
+    def destroy_remote_terraform(self):
+        logging.info('destroy helm charts')
+        with Console.ssh(self.ip, self.user_name, self.pkey_path) as conn:
+            with conn.cd('terraform/ssn-helm-charts/main'):
+                init = conn.run('terraform init').stdout.lower()
+                validate = conn.run('terraform validate').stdout.lower()
+                if 'success' not in init or 'success' not in validate:
+                    raise TerraformProviderError
+                command = 'terraform destroy -auto-approve'
+                logging.info(command)
+                conn.run(command)
+
     def deploy(self):
         logging.info('deploy')
         output = ' '.join(
@@ -868,6 +880,7 @@ class AWSK8sSourceBuilder(AbstractDeployBuilder):
         self.output_terraform_result()
 
     def destroy(self):
+        self.destroy_remote_terraform()
         super(AWSK8sSourceBuilder, self).destroy()
         if self.output_dir is not None:
             shutil.rmtree(self.output_dir)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org