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

VarDict: convenience methods #6647

Merged
merged 5 commits into from Jun 11, 2023

Conversation

russoz
Copy link
Collaborator

@russoz russoz commented Jun 9, 2023

SUMMARY

Add convenience methods for variables and the VarDict class.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

plugins/module_utils/vardict.py

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module_utils module_utils plugins plugin (any type) tests tests unit tests/unit labels Jun 9, 2023
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-7 Automatically create a backport for the stable-7 branch labels Jun 9, 2023
@@ -93,7 +106,7 @@ def __str__(self):


class VarDict(object):
reserved_names = ('__vars__', 'var', 'set_meta', 'set', 'output', 'diff', 'facts', 'has_changed')
reserved_names = ('__vars__', '_var', 'var', 'set_meta', 'get_meta', 'set', 'output', 'diff', 'facts', 'has_changed', 'as_dict')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, isn't changing this field a breaking change (since now using _var, get_meta, and as_dict is illegal and will result in an exception)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess it is - I had not considered it from that perspective. Will update the changelog fragment, but cannot escape from that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, in that case we should probably only merge it for 8.0.0 and not backport it to stable-7.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

makes sense to me

@felixfontein felixfontein added breaking_change This PR contains a breaking change that MUST NOT be backported and removed backport-7 Automatically create a backport for the stable-7 branch labels Jun 10, 2023
@felixfontein felixfontein merged commit 2bd8469 into ansible-collections:main Jun 11, 2023
136 checks passed
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jun 11, 2023
@felixfontein
Copy link
Collaborator

@russoz thanks!

@russoz russoz deleted the vardict-as-dict branch June 11, 2023 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking_change This PR contains a breaking change that MUST NOT be backported feature This issue/PR relates to a feature request module_utils module_utils plugins plugin (any type) tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants