From 7e23ef3801c90b2af574144ba5948102bfad5e52 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 07:28:53 +0100 Subject: [PATCH] fix the issue#5275: iso_create doesn't add folders (#5468) (#5487) * fix the issue * add changelog * add changelog file * Update changelogs/fragments/5468-iso-create-not-add-folders.yml Co-authored-by: Felix Fontein (cherry picked from commit c757e20d108963c65de789c501d53a4f74dffd1f) Co-authored-by: Yuhua Zou <41054978+ZouYuhua@users.noreply.github.com> --- changelogs/fragments/5468-iso-create-not-add-folders.yml | 2 ++ plugins/modules/files/iso_create.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/5468-iso-create-not-add-folders.yml diff --git a/changelogs/fragments/5468-iso-create-not-add-folders.yml b/changelogs/fragments/5468-iso-create-not-add-folders.yml new file mode 100644 index 0000000000..5bbe48f579 --- /dev/null +++ b/changelogs/fragments/5468-iso-create-not-add-folders.yml @@ -0,0 +1,2 @@ +bugfixes: + - iso_create - the module somtimes failed to add folders for Joliet and UDF formats (https://github.com/ansible-collections/community.general/issues/5275). diff --git a/plugins/modules/files/iso_create.py b/plugins/modules/files/iso_create.py index d729f222a2..c457f5a412 100644 --- a/plugins/modules/files/iso_create.py +++ b/plugins/modules/files/iso_create.py @@ -188,9 +188,9 @@ def add_directory(module, iso_file=None, dir_path=None, rock_ridge=None, use_jol if rock_ridge: rr_name = os.path.basename(dir_path) if use_joliet: - joliet_path = iso_dir_path + joliet_path = dir_path if use_udf: - udf_path = iso_dir_path + udf_path = dir_path try: iso_file.add_directory(iso_path=iso_dir_path, rr_name=rr_name, joliet_path=joliet_path, udf_path=udf_path) except Exception as err: @@ -254,7 +254,7 @@ def main(): udf=use_udf ) if not module.check_mode: - iso_file = pycdlib.PyCdlib() + iso_file = pycdlib.PyCdlib(always_consistent=True) iso_file.new(interchange_level=inter_level, vol_ident=volume_id, rock_ridge=rock_ridge, joliet=use_joliet, udf=use_udf) for src_file in src_file_list: