Skip to content

[Enhancement][data_set]Enhance error messages when not able to create GDGs #2212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: staging-v1.16.0-beta.1
Choose a base branch
from

Conversation

mayankmani-sde
Copy link
Collaborator

@mayankmani-sde mayankmani-sde commented Jul 25, 2025

SUMMARY

Override Zoau Error response with more descriptive error messages

#1976

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

data_set

ADDITIONAL INFORMATION
 Case1: Fifo is true 
- hosts: zvm
  collections:
    - ibm.ibm_zos_core
  gather_facts: False
  #vars:
    #ZOAU: "/zoau/v1.3.4"
    #PYZ: "/allpython/3.13/usr/lpp/IBM/cyp/v3r13/pyz"
  environment: "{{ environment_vars }}"
  tasks:
    - name: Create GDG base
      zos_data_set:
        name: "NAZARE.WDEPLOY.ANSIBLE.GDTEST.SEQA"
        type: gdg
        state: present
        limit: 3
        fifo: true
        replace: false
        record_format: fb
        space_primary: 5
        space_secondary: 3
        space_type: m
      register: dataset_creation
The full traceback is:
  File "/tmp/ansible_zos_data_set_payload_mc8ezo9h/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py", line 1965, in run_module
    current_changed = perform_data_set_operations(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_mc8ezo9h/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py", line 1457, in perform_data_set_operations
    changed = data_set.ensure_present(replace=replace)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_mc8ezo9h/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py", line 3009, in ensure_present
    gdg = _create_gdg(arguments)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_mc8ezo9h/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py", line 3000, in _create_gdg
    raise GenerationDataGroupCreateError(msg="FIFO creation failed: the system may not support FIFO datasets or is not configured for it.")
fatal: [zvm]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "batch": null,
            "block_size": null,
            "directory_blocks": null,
            "empty": false,
            "extended": false,
            "fifo": true,
            "force": false,
            "key_length": null,
            "key_offset": null,
            "limit": 3,
            "name": "NAZARE.WDEPLOY.ANSIBLE.GDTEST.SEQA",
            "noscratch": false,
            "purge": false,
            "record_format": "fb",
            "record_length": null,
            "replace": false,
            "scratch": false,
            "sms_data_class": null,
            "sms_management_class": null,
            "sms_storage_class": null,
            "space_primary": 5,
            "space_secondary": 3,
            "space_type": "m",
            "state": "present",
            "tmp_hlq": null,
            "type": "gdg",
            "volumes": null
        }
    },
    "message": "",
    "msg": "GenerationDataGroupCreateError('FIFO creation failed: the system may not support FIFO datasets or is not configured for it.')",
    "names": [
        "NAZARE.WDEPLOY.ANSIBLE.GDTEST.SEQA"
    ]
}

PLAY RECAP *****************************************************************************************************************************************************
zvm                        : ok=0    chan
Case2: When gdg length exceeds 35
- hosts: zvm
  collections:
    - ibm.ibm_zos_core
  gather_facts: False
  #vars:
    #ZOAU: "/zoau/v1.3.4"
    #PYZ: "/allpython/3.13/usr/lpp/IBM/cyp/v3r13/pyz"
  environment: "{{ environment_vars }}"
  tasks:
    - name: Create GDG base
      zos_data_set:
        name: 'THIS.IS.A.VERY.LONG.DATASET.NAME.THAT.EXCEEDS.THIRTY.FIVE.CHARS'
        type: gdg
        state: present
        limit: 5
        empty: true
        scratch: true
      register: dataset_creation
The full traceback is:
  File "/tmp/ansible_zos_data_set_payload_p3pbeouf/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py", line 1965, in run_module
    current_changed = perform_data_set_operations(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_p3pbeouf/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py", line 1457, in perform_data_set_operations
    changed = data_set.ensure_present(replace=replace)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_p3pbeouf/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py", line 2993, in ensure_present
    GenerationDataGroup._validate_gdg_name(name)
  File "/tmp/ansible_zos_data_set_payload_p3pbeouf/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py", line 2950, in _validate_gdg_name
    raise GenerationDataGroupCreateError(
fatal: [zvm]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "batch": null,
            "block_size": null,
            "directory_blocks": null,
            "empty": true,
            "extended": false,
            "fifo": false,
            "force": false,
            "key_length": null,
            "key_offset": null,
            "limit": 5,
            "name": "THIS.IS.A.VERY.LONG.DATASET.NAME.THAT.EXCEEDS.THIRTY.FIVE.CHARS",
            "noscratch": false,
            "purge": false,
            "record_format": "fb",
            "record_length": null,
            "replace": false,
            "scratch": true,
            "sms_data_class": null,
            "sms_management_class": null,
            "sms_storage_class": null,
            "space_primary": 5,
            "space_secondary": 3,
            "space_type": "m",
            "state": "present",
            "tmp_hlq": null,
            "type": "gdg",
            "volumes": null
        }
    },
    "message": "",
    **"msg": "GenerationDataGroupCreateError('GDG creation failed: dataset name exceeds 35 characters.')",**
    "names": [
        "THIS.IS.A.VERY.LONG.DATASET.NAME.THAT.EXCEEDS.THIRTY.FIVE.CHARS"
    ]
}

PLAY RECAP *****************************************************************************************************************************************************
zvm                        : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 
**Case3: Failure when two parameters are not compatible**
- hosts: zvm
  collections:
    - ibm.ibm_zos_core
  gather_facts: False
  #vars:
    #ZOAU: "/zoau/v1.3.4"
    #PYZ: "/allpython/3.13/usr/lpp/IBM/cyp/v3r13/pyz"
  environment: "{{ environment_vars }}"
  tasks:
    - name: Create GDG base
      zos_data_set:
        name: "NAZARE.WDEPLOY.ANSIBLE.GDTEST.SEQA"
        type: gdg
        state: present
        limit: 3
        purge: true
        replace: false
        record_format: fb
        space_primary: 5
        space_secondary: 3
        space_type: m
      register: dataset_creation
The full traceback is:
  File "/tmp/ansible_zos_data_set_payload_rclit_yn/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py", line 1965, in run_module
    current_changed = perform_data_set_operations(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_rclit_yn/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py", line 1457, in perform_data_set_operations
    changed = data_set.ensure_present(replace=replace)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_rclit_yn/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py", line 3009, in ensure_present
    gdg = _create_gdg(arguments)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_zos_data_set_payload_rclit_yn/ansible_zos_data_set_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py", line 3002, in _create_gdg
    raise GenerationDataGroupCreateError(msg="GDG creation failed: 'purge=true' requires 'scratch=true'.")
fatal: [zvm]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "batch": null,
            "block_size": null,
            "directory_blocks": null,
            "empty": false,
            "extended": false,
            "fifo": false,
            "force": false,
            "key_length": null,
            "key_offset": null,
            "limit": 3,
            "name": "NAZARE.WDEPLOY.ANSIBLE.GDTEST.SEQA",
            "noscratch": false,
            "purge": true,
            "record_format": "fb",
            "record_length": null,
            "replace": false,
            "scratch": false,
            "sms_data_class": null,
            "sms_management_class": null,
            "sms_storage_class": null,
            "space_primary": 5,
            "space_secondary": 3,
            "space_type": "m",
            "state": "present",
            "tmp_hlq": null,
            "type": "gdg",
            "volumes": null
        }
    },
    "message": "",
    "msg": "GenerationDataGroupCreateError(\"GDG creation failed: 'purge=true' requires 'scratch=true'.\")",
    "names": [
        "NAZARE.WDEPLOY.ANSIBLE.GDTEST.SEQA"
    ]
}

PLAY RECAP *****************************************************************************************************************************************************
zvm                        : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

@mayankmani-sde mayankmani-sde marked this pull request as ready for review July 25, 2025 06:58
@mayankmani-sde
Copy link
Collaborator Author

Jenkins Pipeline SS:

Screenshot 2025-07-25 at 11 53 50 PM Screenshot 2025-07-25 at 11 54 38 PM Screenshot 2025-07-25 at 11 55 03 PM

if gdgs.exists(arguments.get("name")):
present = True

if not present:
gdg = gdgs.create(**arguments)
# gdg = gdgs.create(**arguments)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code works fine with your changes, I would remove the commented lines with the calls that were previously used.

@@ -0,0 +1,3 @@
minor_changes:
- data_set - Enhances error message for GDG creation failure.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- data_set - Enhances error message for GDG creation failure.
- zos_data_set - Enhances error messages when creating a Generation Data Group fails.

@mayankmani-sde mayankmani-sde changed the title Enhance error messages Enhancement[data_set]Enhance error messages when not able to create GDGs Aug 6, 2025
@mayankmani-sde mayankmani-sde changed the title Enhancement[data_set]Enhance error messages when not able to create GDGs [Enhancement][data_set]Enhance error messages when not able to create GDGs Aug 6, 2025
Copy link
Collaborator

@fernandofloresg fernandofloresg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from Ale's comments I don't have any more to add. LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement][zos_data_set] Enhance error messages when not able to create GDGs
4 participants