Skip to content

Commit 840fb31

Browse files
authored
Fix keeping VM's alive when vm_alive flag is given (#116)
1 parent ae80238 commit 840fb31

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

alts/worker/runners/base.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,13 +1750,12 @@ def setup(self, skip_provision: bool = False):
17501750
self._ssh_client = LongRunSSHClient(**params)
17511751

17521752
def teardown(self, publish_artifacts: bool = True):
1753-
if not self._vm_alive:
1754-
if self._ssh_client:
1755-
try:
1756-
self._ssh_client.close()
1757-
except:
1758-
pass
1759-
super().teardown(publish_artifacts=publish_artifacts)
1753+
if self._ssh_client:
1754+
try:
1755+
self._ssh_client.close()
1756+
except:
1757+
pass
1758+
super().teardown(publish_artifacts=publish_artifacts)
17601759

17611760
def exec_command(self, *args, **kwargs) -> Tuple[int, str, str]:
17621761
command = ' '.join(args)

alts/worker/runners/opennebula.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ def recover_delete():
244244
recover_delete()
245245

246246
def _stop_env(self):
247+
if self._vm_alive:
248+
return 0, "WARNING: VM won't be destroyed because vm_alive=True was given", ""
247249
stop_exit_code, stop_out, stop_err = super()._stop_env()
248250
if stop_exit_code == 0:
249251
return stop_exit_code, stop_out, stop_err

0 commit comments

Comments
 (0)