Skip to content

Conversation

@AndreMarcel99
Copy link
Collaborator

SUMMARY

Filter to get data set names Fixes #2165

ISSUE TYPE
  • Enhancement Pull Request
COMPONENT NAME

Generate data set name from the components use on the tests data set helpers
Screenshot 2025-10-29 at 5 01 44 p m

Screenshot 2025-10-29 at 5 01 27 p m

@AndreMarcel99 AndreMarcel99 changed the title Filter/2165/filter for data set name [Filter][2165]filter_for_data_set_name Oct 29, 2025
@AndreMarcel99 AndreMarcel99 marked this pull request as ready for review October 29, 2025 23:03
Copy link
Collaborator

@richp405 richp405 left a comment

Choose a reason for hiding this comment

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

This can't be merged until the pep8 and bandit issues are resolved.
It looks like a decent change, but non-standard... should be an easy couple of fixes.

richp405
richp405 previously approved these changes Oct 31, 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.

Requested one change and asked a question

from ansible.errors import AnsibleFilterError


def generate_data_set_name(value, generations=1):
Copy link
Collaborator

Choose a reason for hiding this comment

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

At first sight generations might seem to be referring to a different thing, it will be better to use something like count or num_names


EXAMPLES: |
# Get only one data set name.
clean_output: "{{ hlq | ibm.ibm_zos_core.generate_data_set_name}}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the result if I do this ?

{{ ibm.ibm_zos_core.generate_data_set_name }}

Asking because I would expect to have either an error or a randomly generated hlq, when using mvstmp it uses the result of whoami command

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think in this case we cannot generate a valid HLQ even having the ansible user, so we could fail in case no HLQ is provided

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding this!!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update the copyright year

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good, would only add one testing when is empty (if possible even)

@AndreMarcel99
Copy link
Collaborator Author

Screenshot 2025-11-07 at 12 37 44 p m Screenshot 2025-11-07 at 12 38 03 p m

Copy link
Collaborator

@richp405 richp405 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement][Filters] Create a filter that returns a valid temporary data set name

5 participants