Skip to content

Commit

Permalink
Don't remove one directory level from slspath
Browse files Browse the repository at this point in the history
This breaks the tpldir jinja context variable for the cases where there
is an SLS path in the format `X.X` (e.g. `foo.foo`, `bar.bar`, etc.).

It also conflicts with the stated documentation for this parameter in
`doc/rev/states/vars.rst`, which states that this variable should be the
path to the SLS target. In reality this is passed in via
`context['sls']` and already has the correct path.

If I were to wager a guess, I would say that it's likely that the way
`context['sls']` is formulated has changed at some point since these two
lines were added in 2014, making these two lines unnecessary.
  • Loading branch information
Erik Johnson committed Sep 26, 2019
1 parent e2b86bf commit 7c28995
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions salt/utils/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ def render_tmpl(tmplsrc,
slspath = context['sls'].replace('.', '/')
if tmplpath is not None:
context['tplpath'] = tmplpath
if not tmplpath.lower().replace('\\', '/').endswith('/init.sls'):
slspath = os.path.dirname(slspath)
template = tmplpath.replace('\\', '/')
i = template.rfind(slspath.replace('.', '/'))
if i != -1:
Expand Down

0 comments on commit 7c28995

Please sign in to comment.