Search code examples
salt-project

How to get element from return statement with sls file


I have the following line in an .sls file, but it always seems to succeed whatever server I put in there:

{% if salt['network.connect']('server.network.com', 80).result == True -%}

When I run salt-call --local network.connect server.network.com 80 I get the following output:

local:
----------
comment:
    Unable to connect to server.network.com on tcp port 80
result:
    False

The result is structured. How can I get to result in the sls state above?


Solution

  • There's no need for the == True.

    I tested these both:

    {% if salt['network.connect']('server.network.com', 80).result %}
    

    as well as the inverse:

    {% if not salt['network.connect']('server.network.com', 80).result %}