Repository: ansible-collections/community.general

Issue:
iso_create doesn't add folders
### Summary

When trying to add a folder/directory to an iso, using `/path/to/folder` in `src_files`,  the module fails. From the output I can see ansible is parsing the content of the folder, but it doesn't add it to the iso.

### Issue Type

Bug Report

### Component Name

iso_create

### Ansible Version

```
# RHEL VM
$ ansible --version
ansible [core 2.12.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/radam/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  ansible collection location = /home/radam/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
  jinja version = 2.10.3
  libyaml = True

# Arch Linux VM
$ ansible --version
ansible [core 2.13.3]
  config file = None
  configured module search path = ['/home/radu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/radu/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/radu/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/radu/.local/bin/ansible
  python version = 3.10.6 (main, Aug  3 2022, 17:39:45) [GCC 12.1.1 20220730]
  jinja version = 3.1.2
  libyaml = True
```


### Community.general Version

```console (paste below)
>>>  RHEL VM
$ ansible-galaxy collection list community.general

# /home/radam/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.0

>>> Arch Linux VM
$ ansible-galaxy collection list community.general

# /home/radu/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 5.5.0  
```


### Configuration

Folder structure used:
```
files
├── a_simple_text_file.txt
└── scripts
    ├── 1.txt
    ├── 2.txt
    └── 3.txt
```


### OS / Environment

I did tests on two VMs':
RHEL 8.6
Arch Linux

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->

Using create_cd.yml playbook as below:
```yaml
---
- name: Build CD
  hosts: localhost

  tasks:
    - name: Create iso
      community.general.iso_create:
        src_files:
          - "files/a_simple_text_file.txt"
          - "files/scripts"
        dest_iso: "mycd.iso"
        interchange_level: 3
        joliet: 3
        vol_ident: "test"
```

Running the playbook:
```
$ ansible-playbook create_cd.yml
```


### Expected Results

Expected to have an iso containing `a_simple_text_file.txt` and the entire `scripts` subfolder.

### Actual Results

```console (paste below)
$ ansible-playbook create_cd.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Build VM] **************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Create iso] ************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to add file files/scripts/1.txt to ISO file due to Could not find path"}

PLAY RECAP *******************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/files/iso_create.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/files/iso_create.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Tomorrow9
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Hi @raisedfist Thanks for reporting this. We are waiting for the maintainer to pick this issue up.

Or maybe, @ZouYuhua , since you have worked on modules related to ISO files and if you have the availability, you could try and see if you can fix this issue. Just an idea - don't feel obliged.
@russoz 
I will try to fix it.  Thanks.
Thanks in advance for your effort. 

Resolving patch:
diff --git a/plugins/modules/iso_create.py b/plugins/modules/iso_create.py
--- a/plugins/modules/iso_create.py
+++ b/plugins/modules/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:


Test patch: