Skip to content
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

feat(rpm_distribution): add pulp_labels parameter #175

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

joey-grant
Copy link
Contributor

This change adds pulp_labels as an optional parameter to the rpm_distribution module. It also adds tests and fixtures.

This changeset adds `pulp_labels` as an optional parameter to the
`rpm_distribution` module. It also adds tests and fixtures.
Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

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

Thank you for that addition.
I do have one improvement in mind though.

@@ -112,6 +127,7 @@ def main():
"repository": {},
"content_guard": {},
"generate_repo_config": {"type": "bool"},
"pulp_labels": {"type": "dict"},
Copy link
Member

Choose a reason for hiding this comment

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

There's a way to specify this as a dictionary of strings. Let's do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @mdellweg. I've looked into this and cannot determine the method you describe. Specifically, it doesn't appear that argument_spec allows for arbitrary keys, which pulp_labels does. I could potentially change pulp_labels to a list of dictionaries, but that seems generally unhelpful to me. Could you provide some additional guidance if you know of a better way?

Here is some discussion I found, for reference.

Copy link
Member

@mdellweg mdellweg Aug 5, 2024

Choose a reason for hiding this comment

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

Have you tried "elements" or does that only work with "list"? I may have been wrong.

For reference: https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#argument-spec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, that is only for use with the list type. I did give it a try just for fun, but it seems documentation does in fact match implementation on this one.

"msg": "Invalid type dict for option '{'key1': 'value1', 'key2': 'value2'}', elements value check is supported only with 'list' type"

@mdellweg mdellweg merged commit ad4bf8c into pulp:develop Aug 5, 2024
7 checks passed
@joey-grant joey-grant deleted the rpm_distribution_add_pulp_labels branch August 5, 2024 19:07
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.

2 participants