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

Core: add __dict__ representation for HostVars #53855

Open
wants to merge 4 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@sumkincpp
Copy link
Contributor

sumkincpp commented Mar 15, 2019

SUMMARY

Adding dict serializable representation functionality to be used in HostVars
Currently, when dict is needed, simply calling repr(hostvars) isn't informative on final type in a place of usage.

host_vars = HostVars()
# Not informative
repr(host_vars)
host_vars

# Informative
host_vars.__dict__

This may broke some tests, just looking on places where this may matter.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

lib/ansible/vars/hostvars.py

@sumkincpp

This comment has been minimized.

Copy link
Contributor Author

sumkincpp commented Mar 15, 2019

Misused dict and repr, closing issue.

@sumkincpp sumkincpp closed this Mar 15, 2019

@bcoca

This comment has been minimized.

Copy link
Member

bcoca commented Mar 15, 2019

what problem is this addressing?

@ansibot ansibot added core_review and removed needs_revision labels Mar 15, 2019

@ansibot ansibot added needs_revision and removed core_review labels Mar 16, 2019

@sumkincpp

This comment has been minimized.

Copy link
Contributor Author

sumkincpp commented Mar 16, 2019

@bcoca I try to pass all vars(HostVars) to filter to get them filtered&changed, as a result a dict with builtin types for me would be better. Any idea how to transform HostVars to dict?

@bcoca

This comment has been minimized.

Copy link
Member

bcoca commented Mar 18, 2019

Do you really need ALL the hostvars? its not a dict for some good reasons, mostly memory ballooning and performance issues.

hostvars can get very big and we try to avoid many snags by making it 'lazy evaluated' dict like object, forcing all of them to be transformed is not something I would advise.

What is your end goal?

@ansibot ansibot added core_review and removed needs_revision labels Mar 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.