Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- zos_copy - Adds a better error message that gives user a
hint that copy issue can be due to 'src' GDG in edit state.
(https://github.com/ansible-collections/ibm_zos_core/pull/2220)
24 changes: 21 additions & 3 deletions plugins/modules/zos_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,9 +1205,20 @@ def copy_to_gdg(self, src, dest):
# If identical_gdg_copy is False, use the default next generation
dest_gen_name = f"{dest}(+1)"
# Perform the copy operation
rc = datasets.copy(gds.name, dest_gen_name, **copy_args)
if rc != 0:
success = False

try:
result = datasets.copy(gds.name, dest_gen_name, **copy_args)
rc = result.rc if hasattr(result, 'rc') else result
if rc != 0:
success = False
except zoau_exceptions.ZOAUException as e:
stderr = getattr(e.response, 'stderr_response', str(e))
if "BGYSC6003E" in stderr :
raise GenerationDataGroupCreateError(
msg="BGYSC6003E Invalid generation relative name: This might be because the src GDG is in open state"
) from e
else:
raise GenerationDataGroupCreateError(msg=f"GDG creation failed. Raw error: {stderr}") from e
return success

def _copy_tree(self, entries, src, dest, dirs_exist_ok=False):
Expand Down Expand Up @@ -4343,5 +4354,12 @@ def __init__(
super().__init__(msg)


class GenerationDataGroupCreateError(Exception):
def __init__(self, msg):
"""Error during copy of a Generation Data Group."""
self.msg = msg
super().__init__(self.msg)


if __name__ == "__main__":
main()