Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] nginx.servers and "service_function" error #264

Open
vquie opened this issue May 25, 2020 · 1 comment
Open

[BUG] nginx.servers and "service_function" error #264

vquie opened this issue May 25, 2020 · 1 comment
Labels

Comments

@vquie
Copy link

vquie commented May 25, 2020

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 %}

Additional context

@vquie vquie added the bug label May 25, 2020
@daks
Copy link
Member

daks commented Jun 8, 2020

Hello,

can you give use more information about how you tested or find this problem?
I just tried using the docker image default-debian-10-master-py3 which is a Debian 10 with version 3000-n/a-99ffbf1 of salt and:

  • kitchen converge works
  • inside the image, salt-call --local --config-dir=/tmp/kitchen/etc/salt state.sls nginx.servers works too

Do you have any pillar data you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants