mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #16272 from rallytime/bp-16252
Backport #16252 to 2014.7
This commit is contained in:
commit
de50067a91
@ -55,6 +55,19 @@ def wrap_tmpl_func(render_str):
|
|||||||
# We want explicit context to overwrite the **kws
|
# We want explicit context to overwrite the **kws
|
||||||
kws.update(context)
|
kws.update(context)
|
||||||
context = kws
|
context = kws
|
||||||
|
assert 'opts' in context
|
||||||
|
assert 'saltenv' in context
|
||||||
|
|
||||||
|
if 'sls' in context:
|
||||||
|
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)
|
||||||
|
context['slsdotpath'] = slspath.replace('/', '.')
|
||||||
|
context['slscolonpath'] = slspath.replace('/', ':')
|
||||||
|
context['sls_path'] = slspath.replace('/', '_')
|
||||||
|
context['slspath'] = slspath
|
||||||
|
|
||||||
if isinstance(tmplsrc, string_types):
|
if isinstance(tmplsrc, string_types):
|
||||||
if from_str:
|
if from_str:
|
||||||
|
@ -268,6 +268,17 @@ G:
|
|||||||
list('ABCDEFG')
|
list('ABCDEFG')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_slsdir(self):
|
||||||
|
result = render_sls('''
|
||||||
|
formula/woot.sls:
|
||||||
|
cmd.run:
|
||||||
|
- name: echo {{ slspath }}
|
||||||
|
- cwd: /
|
||||||
|
''', sls='formula.woot', argline='yaml . jinja')
|
||||||
|
|
||||||
|
r = result['formula/woot.sls']['cmd.run'][0]['name']
|
||||||
|
self.assertEqual(r, 'echo formula/woot')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from integration import run_tests
|
from integration import run_tests
|
||||||
|
Loading…
Reference in New Issue
Block a user