saltstack/salt — pull request #10961 by bemehow (2014-03-05 06:37:30+00:00)
Title: add module to check existence of files/dir with path expansion

Didn't know which version to mark it as being added to.
Seems like a good shortcut for what I needed to do in the sls file before for lack of other ways:

{% for role in grains['roles'] %}
{% set path = '/usr/local/salt/service/*/'+role %}
{% set expanded_role = salt['cmd.run']('echo '+path) %}
{% if salt['file.exists'](expanded_role) %}
TOP_STATE
{% endif %}
{% endfor %}

{% for role in grains['roles'] %}
{% if salt['file.path_exists_glob('/usr/local/salt/service/*/'+role) %}
TOP_STATE
{% endif %}
{% endfor %}