mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-21 19:29:05 +00:00
iso_extract: retry umount on busy filesystem before cleanup (#11837)
* iso_extract: retry umount on busy filesystem before cleanup Fixes #5333 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * iso_extract: add changelog fragment for #11837 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * make chglog more concise --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e911081102
commit
87ecfa3432
2 changed files with 13 additions and 1 deletions
|
|
@ -93,6 +93,7 @@ RETURN = r"""
|
|||
import os.path
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
|
@ -219,7 +220,14 @@ def main():
|
|||
result["changed"] = True
|
||||
finally:
|
||||
if not binary:
|
||||
module.run_command([module.get_bin_path("umount"), tmp_dir])
|
||||
umount_cmd = [module.get_bin_path("umount"), tmp_dir]
|
||||
for dummy in range(5):
|
||||
rc, dummy, dummy = module.run_command(umount_cmd)
|
||||
if rc == 0:
|
||||
break
|
||||
time.sleep(1)
|
||||
else:
|
||||
module.warn(f"Failed to unmount ISO image from '{tmp_dir}' after 5 attempts.")
|
||||
|
||||
shutil.rmtree(tmp_dir)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue