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

[POC] [WIP] Expose lookups as globals #53336

Open
wants to merge 6 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@sivel
Copy link
Member

sivel commented Mar 5, 2019

SUMMARY

Expose lookups as globals

As of now using a lookup is kind of cumbersome, having to use {{ lookup('name', 'foo') }}. This allows {{ name('foo') }}

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

lib/ansible/template/__init__.py

ADDITIONAL INFORMATION

@sivel

This comment has been minimized.

Copy link
Member Author

sivel commented Mar 5, 2019

bot_skip

@mattclay mattclay added the ci_verified label Mar 6, 2019

sivel added some commits Mar 7, 2019

@bcoca

This comment has been minimized.

Copy link
Member

bcoca commented Mar 18, 2019

won't this cause issues with existing globals being overwritten?

@sivel

This comment has been minimized.

Copy link
Member Author

sivel commented Mar 18, 2019

Unclear right now. I'm just playing. This will likely support namespacing, but I haven't gone back to that PR. I have no intentions of trying to merge this PR anytime soon.

@bcoca

This comment has been minimized.

Copy link
Member

bcoca commented Mar 18, 2019

I had dict filter, i can see someone creating a dict lookup and we know there is a dict global function, it can be easily prevented by checking if it already exists. I don't know the list of all globals Jinja2 uses, but I would avoid overwriting them.

@sivel

This comment has been minimized.

Copy link
Member Author

sivel commented Mar 18, 2019

There is indeed a dict lookup already. Which, yes, would overwrite the dict global provided by jinja2 with this PR as is.

But I don't intend on that being the case long term if I continue pursuing this.

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.