Skip to content

Jinja condition is not being evaluated correctly in salt-ssh minion #56030

@admd

Description

@admd

Description of Issue

I need to check if salt module exist before executing it. So I have a Jinja condition in statefile but it is not working on salt-ssh minion.

Setup

{% if 'network.fqdns' in salt %}
fqdns:
  module.run:
    - name: network.fqdns
{% endif%}

Above excerpt correctly returns nothing when executed on a regular minion and network.fqdns module is not available. But when executed on a salt-ssh minion, it returns.

   module_|-fqdns_|-network.fqdns_|-run": {
            "__id__": "fqdns",
            "__run_num__": 10,
            "changes": {},
            "comment": "Module function network.fqdns is not available",
            "duration": 343.473,
            "name": "network.fqdns",
            "result": false,
            "start_time": "13:14:03.907709"
        }

which is not what I expect.

Steps to Reproduce Issue

Execute a state with a condition like above, once on a regular minion and once on salt-ssh minion. Regular minion will return nothing in case module is not there while salt-ssh minions will return the result as mentioned above.

Versions Report

Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: 1.5.2
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.10
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Jan 11 2017, 10:56:06) [GCC]
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
 
System Versions:
           dist: SuSE 12 x86_64
         locale: UTF-8
        machine: x86_64
        release: 4.4.21-69-default
         system: Linux
        version: SUSE Linux Enterprise Server  12 x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbroken, incorrect, or confusing behaviorseverity-low4th level, cosemtic problems, work around exists

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions