Skip to content

Instantly share code, notes, and snippets.

@wongster80
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wongster80/d246f28a1c713186387c to your computer and use it in GitHub Desktop.
Save wongster80/d246f28a1c713186387c to your computer and use it in GitHub Desktop.
This used to work on 2014.1.13 but fails on 2015.5.0 and 2015.5.2:
state init.sls file content:
{% set TEST_SYMLINK = '/opt/test_symlink' %}
{% if 0 == salt['cmd.retcode']('test -h '~ TEST_SYMLINK ~' ') %}
{{ TEST_SYMLINK }}:
file.symlink:
- target: /opt/yp
- force: True
{% endif %}
running salt-call on the state:
local:
Data failed to compile:
----------
Rendering SLS 'aidandev:test_state' failed: Jinja error: execve() argument 1 must be encoded string without NULL bytes, not str
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/utils/templates.py", line 306, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib64/python2.6/site-packages/jinja2/environment.py", line 669, in render
return self.environment.handle_exception(exc_info, True)
File "<template>", line 18, in top-level template code
File "/usr/lib/python2.6/site-packages/salt/modules/cmdmod.py", line 1099, in retcode
use_vt=use_vt)
File "/usr/lib/python2.6/site-packages/salt/modules/cmdmod.py", line 387, in _run
proc = salt.utils.timed_subprocess.TimedProc(cmd, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/utils/timed_subprocess.py", line 25, in __init__
self.process = subprocess.Popen(args, **kwargs)
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
TypeError: execve() argument 1 must be encoded string without NULL bytes, not str
; line 18
---
[...]
- file: /tmp/dependent_file
- watch:
- file: managed_dependent_file
# If CDH parcels have been deployed create necessary symlinks
{% if 0 == salt['cmd.retcode']('test -h '~ TEST_SYMLINK ~' ') %} <======================
{{ TEST_SYMLINK }}:
file.symlink:
- target: /opt/yp
- force: True
{% endif %}
[...]
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment