ansible-collections / ibm_zos_core

Red Hat Ansible Certified Content for IBM Z
77 stars 44 forks source link

[Bug] [zos_copy] Copy uses opercmd to check if the data set is in use even if the data set is created by the module #1544

Closed fernandofloresg closed 2 months ago

fernandofloresg commented 3 months ago

Is there an existing issue for this?

Bug description

zos_copy is using opercmd and needs higher privileges, but when creating the destination data set itself is not needed.

Check is in the following line:

https://github.com/ansible-collections/ibm_zos_core/blob/9c09b5899bfcb06055d7c186f95f7c5e4ca0f625/plugins/modules/zos_copy.py#L2860

    if dest_ds_type != "USS":
        if not force_lock:
            is_dest_lock = data_set_locked(dest_name)
            if is_dest_lock:
                module.fail_json(
                    msg="Unable to write to dest '{0}' because a task is accessing the data set.".format(dest_name))

We should only check if the destination data set is in use if not created by the module itself.

IBM z/OS Ansible core Version

v1.9.0 (default)

IBM Z Open Automation Utilities

v1.2.5 (default)

IBM Enterprise Python

v3.11.x (default)

ansible-version

v2.16.x (default)

z/OS version

v2.5 (default)

Ansible module

zos_copy

Playbook verbosity output.

No response

Ansible configuration.

No response

Contents of the inventory

No response

Contents of group_vars or host_vars

No response