-
Notifications
You must be signed in to change notification settings - Fork 418
Open
Labels
Description
Your setup
Formula commit hash / release tag
Commit Hash: a288342
Versions reports (master & minion)
minion:
# salt-minion --versions-report
Salt Version:
Salt: 3000.3
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.7.3 (default, Apr 3 2019, 05:39:12)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.1.2
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist: debian 10.1
locale: UTF-8
machine: x86_64
release: 4.19.0-6-amd64
system: Linux
version: debian 10.1
master:
# salt-master --versions-report
Salt Version:
Salt: 3000.3
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: 2.0.5
gitpython: 2.1.11
Jinja2: 2.10
libgit2: 0.27.7
M2Crypto: Not Installed
Mako: 1.1.2
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: 1.3.10
pycparser: 2.19
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.27.4
Python: 3.7.3 (default, Apr 3 2019, 05:39:12)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.1.2
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist: debian 10.1
locale: UTF-8
machine: x86_64
release: 4.19.0-6-amd64
system: Linux
version: debian 10.1
Bug details
Describe the bug
salt-call state.sls nginx.servers
fails with the following error.
local:
Data failed to compile:
----------
Rendering SLS 'base:nginx.servers' failed: Jinja variable the template u'nginx/service.sls' (imported on line 8) does not export the requested name 'service_function'
Attempts to fix the bug
Setting service_function in servers.sls directly without importing it, works as expected.
diff --git a/nginx/servers.sls b/nginx/servers.sls
index f3033bb..3dc517d 100644
--- a/nginx/servers.sls
+++ b/nginx/servers.sls
@@ -5,7 +5,8 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
{%- from tplroot ~ '/servers_config.sls' import server_states with context %}
-{%- from tplroot ~ '/service.sls' import service_function with context %}
+
+{% set service_function = {True:'running', False:'dead'}.get(nginx.service.enable) %}
{% macro file_requisites(states) %}
{%- for state in states %}