-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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(tpldata): provide tplroot
#51814
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* http://jinja.pocoo.org/docs/2.10/templates/#math -- re: `+` - "This, however, is not the preferred way to concatenate strings!" * http://jinja.pocoo.org/docs/2.10/templates/#other-operators -- re: `~` - "Converts all operands into strings and concatenates them."
Working on making SaltStack Formulas portable, find the need for a common point of reference. Comparing the import of `map.jinja` with and without context: | `tpldata` | without context | with context | |-----------|--------------------|--------------------------| | `tplfile` | template/map.jinja | template/pkg/install.sls | | `tpldir` | template | template/pkg | | `tpldot` | template | template.pkg | | `tplroot` | template | template | With `tplroot`, it is possible to use a single point of reference for all paths, avoiding the various incantations currently used, such as: * `from tpldir ~ "/map.jinja" import ...` * `from salt.file.dirname(tpldir) ~ "/map.jinja" import ...` * `from salt['file.dirname'](tpldir) ~ "/map.jinja" import ...` In all of the above circumstances, this simply becomes: * `from tplroot ~ "/map.jinja" import ...` Additional benefits are gained when referencing by colon `:` for pillars or by period `.` for `include` statements or for any requisites. Related issues: saltstack#10838, saltstack#41195.
myii
added a commit
to myii/template-formula
that referenced
this pull request
Feb 26, 2019
* Upstream feature request PR: - saltstack/salt#51814
myii
added a commit
to myii/template-formula
that referenced
this pull request
Feb 28, 2019
* Upstream feature request PR: - saltstack/salt#51814
71 tasks
Akm0d
approved these changes
Jun 14, 2019
cmcmarrow
approved these changes
Jun 14, 2019
myii
added a commit
to myii/template-formula
that referenced
this pull request
Jun 25, 2019
myii
added a commit
to myii/template-formula
that referenced
this pull request
Jun 25, 2019
Closed
sagetherage
added
has master-port
port to master has been created
and removed
master-port
labels
May 12, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: Happy to rebase the commits to remove the commit body text if a hindrance of any kind.
What does this PR do?
Working on making SaltStack Formulas portable, find the need for a
common point of reference. Comparing the import of
map.jinja
with andwithout context:
tpldata
tplfile
tpldir
tpldot
tplroot
With
tplroot
, it is possible to use a single point of reference forall paths, avoiding the various incantations currently used, such as:
from tpldir ~ "/map.jinja" import ...
from salt.file.dirname(tpldir) ~ "/map.jinja" import ...
from salt['file.dirname'](tpldir) ~ "/map.jinja" import ...
In all of the above circumstances, this simply becomes:
from tplroot ~ "/map.jinja" import ...
Additional benefits are gained when referencing by colon
:
for pillarsor by period
.
forinclude
statements or for any requisites.What issues does this PR fix or reference?
Related issues: #10838, #41195.
Related PR: saltstack-formulas/template-formula#48.
Tests written?
No.
Commits signed with GPG?
No.