prepare test case:
# echo '{% import_yaml "a.yaml" as a with context %}' > a.sls
# echo 'a: {{ "now"|strftime }}' > a.yaml
remove 'import salt.utils.daeutils' from salt/utils/templates.py, then run
# salt-call state.sls a
[CRITICAL] Rendering SLS 'base:a' failed: Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 169, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 395, in render_jinja_tmpl
line, out = _get_jinja_error(trace, context=decoded_context)
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 248, in _get_jinja_error
line = _get_jinja_error_line(trace)
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 231, in _get_jinja_error_line
return _get_jinja_error_slug(tb_data)[1]
TypeError: 'NoneType' object has no attribute '__getitem__'
after apply the patch:
# salt-call state.sls a
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 169, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 402, in render_jinja_tmpl
tmplstr)
SaltRenderError: Jinja syntax error: no filter named 'strftime'
/var/cache/salt/minion/files/base/a.yaml(1):
---
a: {{ "now"|strftime }} <======================
---
[CRITICAL] Rendering SLS 'base:a' failed: Jinja syntax error: no filter named 'strftime'
/var/cache/salt/minion/files/base/a.yaml(1):
---
a: {{ "now"|strftime }} <======================
---
which shows accurate information for debug.
The commit ba7d00f5 change _cpv_to_cp inner implementation, but the
original parameter cpv is not changed, its format is `<p>-<v>`, and
`dep_getkey` need format for `=<p>-<v>` if `cpv` with version, so it cause
`InvalidAtom` exception and actually return cpv itself. So I add the
original implementation back to fix this problem and still keep
`dep_getkey` if the cpv format will be fixed in the future
Removes the `Hostname` paramater in the winrm create command. It is not
needed. It must match the hostname on the certificate, which is not
defined in the case of the Remote Desktop certificate
Removes extra spaces