mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-21 11:19:00 +00:00
[PR #11825/d1448b76 backport][stable-12] iso_extract: strip leading path separator from file entries (#11832)
iso_extract: strip leading path separator from file entries (#11825)
* iso_extract: strip leading path separator from file entries
Fixes #5283
* iso_extract: add changelog fragment for issue 5283
---------
(cherry picked from commit d1448b76c1)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1b4e58bbbf
commit
f78a44c6a3
3 changed files with 21 additions and 2 deletions
|
|
@ -48,6 +48,7 @@ options:
|
|||
description:
|
||||
- A list of files to extract from the image.
|
||||
- Extracting directories does not work.
|
||||
- File paths should not include a leading V(/); any leading path separator is automatically stripped.
|
||||
type: list
|
||||
elements: str
|
||||
required: true
|
||||
|
|
@ -138,11 +139,11 @@ def main():
|
|||
module.fail_json(msg=f"ISO image '{image}' does not exist")
|
||||
|
||||
result["files"] = []
|
||||
extract_files = list(files)
|
||||
extract_files = [f.lstrip(os.sep) for f in files]
|
||||
|
||||
if not force:
|
||||
# Check if we have to process any files based on existence
|
||||
for f in files:
|
||||
for f in extract_files[:]:
|
||||
dest_file = os.path.join(dest, os.path.basename(f))
|
||||
if os.path.exists(dest_file):
|
||||
result["files"].append(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue