You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
calling {% if salt['pillar.file_exists']('test') %}
always fails. Just changing it to {% if salt['pillar.file_exists']('test/init.sls') %}
works as expected (as long as test/init.sls is there, even if empty).
Setup
From /srv/pillar:
top.sls (working version):
{% set dom=grains['domain']|replace('.', '_') %}{% set hostbase = "{0}_{1}".format(grains['host'], dom) %}base:
'*':
- default{% if salt['pillar.file_exists']('hostdata/'+hostbase+'.sls') %}
- hostdata.{{hostbase}}{% endif %}{% if salt['pillar.file_exists'](dom+'/init.sls') %}'*.{{ grains['domain'] }}':
- {{ dom }} # init.sls contains the domain defaults{% if salt['pillar.file_exists']("{0}/{1}".format(dom,grains['host'])+'.sls') %}
- {{ dom }}.{{ grains['host'] }} # Host-specific pillars{% endif %}{% endif %}
hostdata/host_domain_name_tld.sls : generic pillar data for host
domain_name_tld/ : pillar data for hosts in domain.name.tld
domain_name_tld/host.sls : pillar data for host.domain.name.tld
on-prem machine
VM (Virtualbox, KVM, etc. please specify) kvm
VM running on a cloud service, please be explicit and add details
container (Kubernetes, Docker, containerd, etc. please specify)
or a combination, please be explicit
jails if it is FreeBSD
Steps to Reproduce the behavior salt '*' saltutil.refresh_pillar && salt ctl\* pillar.items
does not show items in domain_name_tld/host.sls since the first if fails when testing the directory. If, like in the snippet above, I test for init.sls, it works as expected.
Expected behavior
pillar.file_exists should treat a directory like a file and return true if it exists. Alternatively, there should be a pillar.directory_exists function (and a notice in the docs, maybe).
Versions Report
salt --versions-report
Salt Version:
Salt: 3004.1Dependency Versions:
cffi: Not Installedcherrypy: Not Installeddateutil: 2.8.1docker-py: Not Installedgitdb: 4.0.5gitpython: 3.1.14Jinja2: 2.11.3libgit2: 1.1.0M2Crypto: Not InstalledMako: Not Installedmsgpack: 1.0.0msgpack-pure: Not Installedmysql-python: Not Installedpycparser: Not Installedpycrypto: Not Installedpycryptodome: 3.9.7pygit2: 1.4.0Python: 3.9.2 (default, Feb 28 2021, 17:03:44)python-gnupg: Not InstalledPyYAML: 5.3.1PyZMQ: 20.0.0smmap: 4.0.0timelib: Not InstalledTornado: 4.5.3ZMQ: 4.3.4System Versions:
dist: debian 11 bullseyelocale: utf-8machine: x86_64release: 5.10.0-14-amd64system: Linuxversion: Debian GNU/Linux 11 bullseye
The text was updated successfully, but these errors were encountered:
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!
Description
calling
{% if salt['pillar.file_exists']('test') %}
always fails. Just changing it to
{% if salt['pillar.file_exists']('test/init.sls') %}
works as expected (as long as test/init.sls is there, even if empty).
Setup
From /srv/pillar:
Steps to Reproduce the behavior
salt '*' saltutil.refresh_pillar && salt ctl\* pillar.items
does not show items in domain_name_tld/host.sls since the first if fails when testing the directory. If, like in the snippet above, I test for init.sls, it works as expected.
Expected behavior
pillar.file_exists should treat a directory like a file and return true if it exists. Alternatively, there should be a pillar.directory_exists function (and a notice in the docs, maybe).
Versions Report
salt --versions-report
The text was updated successfully, but these errors were encountered: