Skip to content

Commit

Permalink
Fix race condition deleting infra
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jul 18, 2024
1 parent 6268d66 commit 24dfa9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion IM/ConfManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ def call_ansible(self, tmp_dir, inventory, playbook, ssh):
self.ansible_process.start()

wait = 0
while result.empty() and self.ansible_process.is_alive():
while result.empty() and self.ansible_process.is_alive() and not self._stop_thread:
if wait >= Config.ANSIBLE_INSTALL_TIMEOUT:
self.log_error('Timeout waiting Ansible process to finish')
try:
Expand All @@ -1300,6 +1300,10 @@ def call_ansible(self, tmp_dir, inventory, playbook, ssh):
time.sleep(Config.CHECK_CTXT_PROCESS_INTERVAL)
wait += Config.CHECK_CTXT_PROCESS_INTERVAL

if self._stop_thread:
self.log_info('Ansible process stopped.')
return (False, "Ansible process stopped.")

self.log_info('Ansible process finished.')

try:
Expand Down

0 comments on commit 24dfa9f

Please sign in to comment.