wildcard include pillar data broken?
salt cronos pillar.items
cronos:
----------
_errors:
- Specified SLS 'accounts.*' in environment 'base' is not available on the salt master
groups:
----------
sysadmin:
----------
description:
system administrators
gid:
2100
users:
----------
description:
users
gid:
2000
salt:
----------
log_level_logfile:
warning
master:
master.example.com
pkg_provider:
pkgin
prefix:
/srv/salt/config
schedule_highstate:
False
smtp:
----------
server:
smtp.example.com
tls:
True
accounts/init.sls
####
## accounts
####
## Template: (required) [optional]
## groups:
## group_name:
## gid: (1000)
## description: (my example group)
## users:
## - [user_a]
## - [user_b]
####
## define users
include:
- accounts.*
## define groups
groups:
users:
gid: 2000
description: users
sysadmin:
gid: 2100
description: system administrators
# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2
accounts/sjorge.sls
####
## user
####
fullname: Jorge Schrauwen
username: sjorge
uid: 1000
shell:
- zsh
- bash
groups:
- users
- sysadmin
Error in master's log
Pillar render error: Specified SLS 'accounts.*' in environment 'base' is not available on the salt master
@sjorge, thanks for the report. What version of salt are you using?
develop, build just the merge of my pkgin fix.
+1 exacly the same problem as of sjorge's
I've been trying to debug this one a bit, but get hopelessly lost.
Seems the state include stuff is in salt/state.py and the piller include stuff isi n salt/pillar/__init__.py...
But I can't figure out where the actual include paths are processed? The pillar one seems to call get_state which is even more confusing just before the line where the error message is located (salt/pillar/__init.py#L567). ?
I did some more digging, not sure this is correct but
includein states is implemented in state.py- state.py use
fmatchto resolev the globbing somehow (still don't get the full picture) includein pillars lives inpillar/__init__.pyuses fileclient.py'sget_stateto retrieve a state file (or a pillar file I guess) from the master.- get_state gets the value as is... since this seems to run on the minion and not the master we cannot just use fmatch to try and resolve the globbing.
@jfindlay Does this seem right?
My first idea would be to make get_state also resolve the globbing but then we'd return multiple files which is not possible (I think). Any ideas?
@sjorge, I am not too familiar with the code, but that seems basically correct. I'm not so sure this is a bug as it is intended behavior/possible feature request. It is natural to think of state and pillar information in parallel ways, but one of the purposes of the pillar system is to store privileged data, so if something like this were implemented, it would have to be careful to only match against data explicitly allowed to that minion by the pillar top file.
Whatever came of this? I have a usecase for it, but I think I am going to have to hack around it using ext_pillar in my top file and it's really ugly:
ext_pillar:
- cmd_yaml: if [ "$s" == "$( hostname )" ]; then; cat /srv/pillar/katello/client/*; fi
Early release notes specify this works for "SLS Modules." I realize that wasn't meant to include pillars, but it would be nice and probably the expected behavior based on the fact it works for states.
Overview
It would be wonderful if pillar includes could use globs--especially since they are supported within pillar top file.
Please do not "protect" us from globs in the name of security.
Description
This works:
top.sls:
include:
'*':
- user.passwords.*
This does not work:
user/init.sls:
include:
- user.passwords.*
This does not work:
user/init.sls:
include:
- 'user.passwords.*'
This does not work:
user/init.sls:
include:
- user.passwords.\*
Versions Report
Salt Version:
Salt: 2018.3.3
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.3
docker-py: Not Installed
gitdb: 2.0.0
gitpython: 2.1.1
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: 0.24.5
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.24.2
Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 2.0.1
timelib: Not Installed
Tornado: 4.4.3
ZMQ: 4.2.1
System Versions:
dist: debian 9.6
locale: UTF-8
machine: x86_64
release: 4.9.0-8-amd64
system: Linux
version: debian 9.6
I am going to close this since it is presented as a bug when I believe it is a feature request. If this is still wanted please open it up as a feature request.