Closed joni1993 closed 6 years ago
This is working as expected, this state was not built to handle using mountpoints, it was written to live at the root of the fileserver.
The formula will need to be updated to use slspath
in order to find the sls file relative to where it is mounted for you to be able to use a mount point.
https://docs.saltstack.com/en/latest/ref/states/vars.html#slspath
Ok, after rewriting the formula it complains about the jinja not being there:
Data failed to compile:
----------
Rendering SLS 'base:services.control.salt.pkgrepo.debian' failed: Jinja error: services/control/salt/pkgrepo/debian/../../map.jinja
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 1, in top-level template code
File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 107, in get_source
raise TemplateNotFound(template)
TemplateNotFound: services/control/salt/pkgrepo/debian/../../map.jinja
; line 1
---
{%- from slspath ~ "/../../map.jinja" import salt_settings with context -%} <======================
saltstack-pkgrepo:
pkgrepo.managed:
- humanname: SaltStack Debian Repo
- name: {{ salt_settings.pkgrepo }}
[...]
---
But "salt-run fileserver.file_list" shows that the file is there:
- services/control/salt/api.sls
- services/control/salt/cloud.sls
- services/control/salt/defaults.yaml
- services/control/salt/files/cloud.maps.d/_ec2.conf
- services/control/salt/files/cloud.maps.d/_gce.conf
- services/control/salt/files/cloud.maps.d/_rsos.conf
- services/control/salt/files/cloud.maps.d/_saltify.conf
- services/control/salt/files/cloud.profiles.d/_ec2.conf
- services/control/salt/files/cloud.profiles.d/_gce.conf
- services/control/salt/files/cloud.profiles.d/_rsos.conf
- services/control/salt/files/cloud.profiles.d/_saltify.conf
- services/control/salt/files/cloud.providers.d/_ec2.conf
- services/control/salt/files/cloud.providers.d/_gce.conf
- services/control/salt/files/cloud.providers.d/_rsos.conf
- services/control/salt/files/cloud.providers.d/_saltify.conf
- services/control/salt/files/gitfs_key.jinja
- services/control/salt/files/key
- services/control/salt/files/master.d/engine.conf
- services/control/salt/files/master.d/f_defaults.conf
- services/control/salt/files/master.d/lxc_profiles.conf
- services/control/salt/files/master.d/reactor.conf
- services/control/salt/files/minion.d/beacons.conf
- services/control/salt/files/minion.d/engine.conf
- services/control/salt/files/minion.d/f_defaults.conf
- services/control/salt/files/minion.d/reactor.conf
- services/control/salt/files/roster.jinja
- services/control/salt/formulas.jinja
- services/control/salt/formulas.sls
- services/control/salt/gitfs/dulwich.sls
- services/control/salt/gitfs/gitpython.sls
- services/control/salt/gitfs/keys.sls
- services/control/salt/gitfs/pygit2.sls
- services/control/salt/map.jinja
- services/control/salt/master.sls
- services/control/salt/minion.sls
- services/control/salt/pkgrepo/absent.sls
- services/control/salt/pkgrepo/debian/absent.sls
- services/control/salt/pkgrepo/debian/init.sls
- services/control/salt/pkgrepo/init.sls
- services/control/salt/pkgrepo/redhat/absent.sls
- services/control/salt/pkgrepo/redhat/init.sls
- services/control/salt/ssh.sls
- services/control/salt/standalone.sls
- services/control/salt/syndic.sls
- top.sls
But this is probably because https://github.com/saltstack/salt/pull/47490 is not in 2018.3.2 yet? Is https://github.com/saltstack/salt/pull/47490 scheduled to be included in the next release?
It will be in the Fluorine major release.
On Thu, Sep 27, 2018, 5:06 AM Christian Jonak notifications@github.com wrote:
Ok, after rewriting the formula it complains about the jinja not being there:
Data failed to compile:
Rendering SLS 'base:services.control.salt.pkgrepo.debian' failed: Jinja error: services/control/salt/pkgrepo/debian/../../map.jinja
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render return self.environment.handle_exception(exc_info, True) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception reraise(exc_type, exc_value, tb) File "", line 1, in top-level template code File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 107, in get_source raise TemplateNotFound(template) TemplateNotFound: services/control/salt/pkgrepo/debian/../../map.jinja
; line 1
{%- from slspath ~ "/../../map.jinja" import salt_settings with context -%} <======================
saltstack-pkgrepo: pkgrepo.managed:
- humanname: SaltStack Debian Repo
name: {{ salt_settings.pkgrepo }} [...]
But "salt-run fileserver.file_list" shows that the file is there:
- services/control/salt/api.sls
- services/control/salt/cloud.sls
- services/control/salt/defaults.yaml
- services/control/salt/files/cloud.maps.d/_ec2.conf
- services/control/salt/files/cloud.maps.d/_gce.conf
- services/control/salt/files/cloud.maps.d/_rsos.conf
- services/control/salt/files/cloud.maps.d/_saltify.conf
- services/control/salt/files/cloud.profiles.d/_ec2.conf
- services/control/salt/files/cloud.profiles.d/_gce.conf
- services/control/salt/files/cloud.profiles.d/_rsos.conf
- services/control/salt/files/cloud.profiles.d/_saltify.conf
- services/control/salt/files/cloud.providers.d/_ec2.conf
- services/control/salt/files/cloud.providers.d/_gce.conf
- services/control/salt/files/cloud.providers.d/_rsos.conf
- services/control/salt/files/cloud.providers.d/_saltify.conf
- services/control/salt/files/gitfs_key.jinja
- services/control/salt/files/key
- services/control/salt/files/master.d/engine.conf
- services/control/salt/files/master.d/f_defaults.conf
- services/control/salt/files/master.d/lxc_profiles.conf
- services/control/salt/files/master.d/reactor.conf
- services/control/salt/files/minion.d/beacons.conf
- services/control/salt/files/minion.d/engine.conf
- services/control/salt/files/minion.d/f_defaults.conf
- services/control/salt/files/minion.d/reactor.conf
- services/control/salt/files/roster.jinja
- services/control/salt/formulas.jinja
- services/control/salt/formulas.sls
- services/control/salt/gitfs/dulwich.sls
- services/control/salt/gitfs/gitpython.sls
- services/control/salt/gitfs/keys.sls
- services/control/salt/gitfs/pygit2.sls
- services/control/salt/map.jinja
- services/control/salt/master.sls
- services/control/salt/minion.sls
- services/control/salt/pkgrepo/absent.sls
- services/control/salt/pkgrepo/debian/absent.sls
- services/control/salt/pkgrepo/debian/init.sls
- services/control/salt/pkgrepo/init.sls
- services/control/salt/pkgrepo/redhat/absent.sls
- services/control/salt/pkgrepo/redhat/init.sls
- services/control/salt/ssh.sls
- services/control/salt/standalone.sls
- services/control/salt/syndic.sls
- top.sls
But this is probably because #47490 https://github.com/saltstack/salt/pull/47490 is not in 2018.3.2 yet? Is #47490 https://github.com/saltstack/salt/pull/47490 scheduled to be included in the next release?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/saltstack/salt/issues/49783#issuecomment-425034595, or mute the thread https://github.com/notifications/unsubscribe-auth/AAssocRAhtqORF9KaaEWc13WfQWC9rcWks5ufKMlgaJpZM4W6ghJ .
Description of Issue/Question
When using the mointpoint option with public formulas (e.g. https://github.com/saltstack-formulas/salt-formula), the formula fails when importing in a jinja template.
For example i want to include the salt-formula but i want to use it from a specific mountpoint (e.g. services.control.salt instead of just salt).
This issue is probably related to https://github.com/saltstack/salt/issues/39881 and https://github.com/saltstack/salt/issues/19564 but it happens with "salt" and not "salt-ssh".
Setup
Master configuration
Master GitFS Remote Config A
Master GitFS Remote Config B
Top File A (with root option)
Top File B (Without root option)
Steps to Reproduce Issue
; line 1
{% from "salt/map.jinja" import salt_settings with context %} <======================
salt-master: {% if salt_settings.install_packages %} pkg.installed:
name: {{ salt_settings.salt_master }} [...]
Rendering SLS 'base:services.control.salt.minion' failed: Jinja error: salt/map.jinja Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render return self.environment.handle_exception(exc_info, True) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception reraise(exc_type, exc_value, tb) File "", line 1, in top-level template code File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 140, in get_source raise TemplateNotFound(template) TemplateNotFound: salt/map.jinja
; line 1
{% from "salt/map.jinja" import salt_settings with context %} <======================
{% if salt_settings.install_packages and grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source != '' and salt_settings.version != '' %} {# only download IF we know where to get the pkg from and if we know what version to check the current install (if installed) against #} {# e.g. don't download unless it appears as though we're about to try and upgrade the minion #} download-salt-minion: [...]
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render return self.environment.handle_exception(exc_info, True) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception reraise(exc_type, exc_value, tb) File "", line 1, in top-level template code File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 140, in get_source raise TemplateNotFound(template) TemplateNotFound: salt/map.jinja
; line 1
{% from "salt/map.jinja" import salt_settings with context %} <======================
saltstack-pkgrepo: pkgrepo.managed:
name: {{ salt_settings.pkgrepo }} [...]
Data failed to compile:
Rendering SLS 'base:services.control.salt.salt.pkgrepo.debian' failed: Jinja error: salt/map.jinja Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render return self.environment.handle_exception(exc_info, True) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception reraise(exc_type, exc_value, tb) File "", line 1, in top-level template code File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 140, in get_source raise TemplateNotFound(template) TemplateNotFound: salt/map.jinja
; line 1
{% from "salt/map.jinja" import salt_settings with context %} <======================
saltstack-pkgrepo: pkgrepo.managed:
name: {{ salt_settings.pkgrepo }} [...]
Rendering SLS 'base:services.control.salt.salt.master' failed: Jinja error: salt/map.jinja Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render return self.environment.handle_exception(exc_info, True) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception reraise(exc_type, exc_value, tb) File "", line 1, in top-level template code File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 140, in get_source raise TemplateNotFound(template) TemplateNotFound: salt/map.jinja
; line 1
{% from "salt/map.jinja" import salt_settings with context %} <======================
salt-master: {% if salt_settings.install_packages %} pkg.installed:
name: {{ salt_settings.salt_master }} [...]
Rendering SLS 'base:services.control.salt.salt.minion' failed: Jinja error: salt/map.jinja Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 389, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render return self.environment.handle_exception(exc_info, True) File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception reraise(exc_type, exc_value, tb) File "", line 1, in top-level template code File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 140, in get_source raise TemplateNotFound(template) TemplateNotFound: salt/map.jinja
; line 1
{% from "salt/map.jinja" import salt_settings with context %} <======================
{% if salt_settings.install_packages and grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source != '' and salt_settings.version != '' %} {# only download IF we know where to get the pkg from and if we know what version to check the current install (if installed) against #} {# e.g. don't download unless it appears as though we're about to try and upgrade the minion #} download-salt-minion: [...]
Salt Version: Salt: 2018.3.2
Dependency Versions: cffi: 1.10.0 cherrypy: 3.7.0 dateutil: 2.4.2 docker-py: Not Installed gitdb: 0.6.4 gitpython: 1.0.1 ioflo: Not Installed Jinja2: 2.8 libgit2: 0.24.0 libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.3 msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: Not Installed pycparser: 2.14 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.24.0 Python: 2.7.12 (default, Dec 4 2017, 14:50:18) python-gnupg: 0.3.8 PyYAML: 3.11 PyZMQ: 15.2.0 RAET: Not Installed smmap: 0.9.0 timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4
System Versions: dist: Ubuntu 16.04 xenial locale: UTF-8 machine: x86_64 release: 4.4.0-135-generic system: Linux version: Ubuntu 16.04 xenial