-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Using salt-ssh:
When using import_text in jinja states, referencing files stored on a gitfs remote, the file cannot be found[1]. This works fine when executed via the minion, but fails with salt-ssh.
This seems to have a cascading effect that other files stored on the gitfs, for subsequent IDs in the same state (possibly other states too) also become unavailable even for salt:// references.
For example, file.managed with source: salt://will fail to find the source file which is located on the gitfs backend. When not run subsequent to an import_text, these file.managed states work fine and pull the file from the gitfs just fine. It's as if the import_text breaks something.
In addition to this, if the import_text file is made available on a local file_root so that this loads fine, the subsequently executed IDs using file.managed and source: salt:// still fail to find the gitfs source files. Again, it appears as if once the import_text has happened, the gitfs backend is gone and the only place being checked is the local file_root[2]
[1]
- Rendering SLS 'base:mystates.teststate' failed: Jinja error: mystates/files/myfile.txt
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 368, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 3, in top-level template code
File "/usr/lib/python2.7/site-packages/salt/utils/jinja.py", line 135, in get_source
raise TemplateNotFound(template)
TemplateNotFound: mystates/files/myfile.txt
[2]
[DEBUG ] Could not find file 'salt://mystates/files/managed_file' in saltenv 'base'
[INFO ] Caching directory 'mystates/files/managed_file/' for environment 'base'
...
ID: test_managed_state
Function: file.managed
Name: /tmp/managed_file
Result: False
Comment: Source file salt://mystates/files/managed_file not found
Started: 10:52:16.657665
Duration: 77.732 ms
Changes:
Example state:
test_import_state:
{% import_text "mystates/files/myfile.txt" as myfile %}
cmd.run:
- name: echo {{ myfile }}
test_managed_state:
file.managed:
- name: /tmp/managed_file
- makedirs: True
- dirmode: 700
- user: root
- group: root
- source: salt://mystates/files/managed_file
# salt --versions-report
Salt Version:
Salt: 2016.11.1
Dependency Versions:
cffi: 1.6.0
cherrypy: 3.2.2
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: 0.25.1
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pygit2: 0.25.0
Python: 2.7.5 (default, Nov 6 2016, 00:28:07)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.3.1611 Core
machine: x86_64
release: 3.10.0-229.4.2.el7.x86_64
system: Linux
version: CentOS Linux 7.3.1611 Core