ibm_zos_core icon indicating copy to clipboard operation
ibm_zos_core copied to clipboard

[Enabler] [zos_find] GDG/GDS and special character support

Open ddimatos opened this issue 10 months ago • 1 comments

Enabler description

MVSDataSet(
            name = params.get("name"),
            record_format = params.get("record_format", None),
            volumes = params.get("volumes", None),
            data_set_type = params.get("type", None),
            block_size = params.get("block_size", None),
            record_length = params.get("record_length", None),
            space_primary = params.get("space_primary", None),
            space_secondary = params.get("space_secondary", None),
            space_type = params.get("space_type", None),
            directory_blocks = params.get("directory_blocks", None),
            key_length = params.get("key_length", None),
            key_offset = params.get("key_offset", None),
            sms_storage_class = params.get("sms_storage_class", None),
            sms_data_class = params.get("sms_data_class", None),
            sms_management_class = params.get("sms_management_class", None),
        )

GDG/GDS Support

Option patterns and pds_patterns accept a list of string either as a pattern or a list of data set names, so user can provide a list of data set names that contain some GDS relative data set names, in that case, the module needs to resolve the relative name into absolute name before packing to correctly archive the given data set name.

- name: Exclude data sets that have a low level qualifier 'TEST'
  zos_find:
    patterns: ZOAUSER.GDG(-1)
    contains: "hello"

Internally, in the case of a data set name being a GDS relative name we should resolve those names into absolute GDS names when the generation number is 0 or negative.

Following functions will be implemented in #1386

# Sample of soon to be implemented gdg function
if DataSet.is_gds_relative_name(name):
    src = DataSet.resolve_gds_absolute_name(src)

Symbols support

Changes done to the BetterArgParser should be adopted in the module to not break and use the correct escaped name in case of the data set name having a symbol in it.

Add symbol support to the dest_data_set name option.

data set name with symbol

ZOAUSER.TE$T

That way, the modules will have to retrieve the new escaped named and the original user provided name inside the dictionary like:

name = DataSet.escape_data_set_name(name)

Escaping special characters could be done via a new function inside the BetterArgParser. These are some of the special characters:

  • #
  • @
  • $
  • -

For this task completion we need:

  • [ ] Do the development work
  • [ ] Update the docs to talk about GDG and GDS handling in the module.
  • [ ] Update the docs with at least 1 example on how to use with GDSs.
  • [ ] Create a new test case for GDSs.
  • [ ] Create a new test case for symbols.

Ansible module

zos_find

ddimatos avatar Apr 03 '24 06:04 ddimatos

This is a regression for gdg, which is working. I will add special character tests and re-run.

Image

richp405 avatar May 22 '24 16:05 richp405