[salt-ssh] Custom pillar data present in pillar.items, but not in custom execution module through __pillar__ dictionary
(Encountered in version 2015.8.3)
Hello!
I am running into an interesting issue using salt-ssh to execute custom modules relying on pillar data.
When querying for the target's pillar using: salt-ssh '*' pillar.items the custom pillar entries are present, however within a custom execution module the __pillar__ entry only contains the default set of master pillar entries, none of the custom entries.
Checking the pillar.json that is deployed via salt-ssh to the target in salt_state.tgz the full pillar is visible.
The custom module that I have resulted to testing with whilst attempting to debug is:
def test():
return __pillar__
Has anyone ran into anything similar? I can find some open issues regarding salt-ssh and pillars but most of these seem to be in regards to failing to render the pillar at all.
To add some more information, if I call my custom module from within a simple state wrapper:
pillar_test_state:
module.run:
- name: pillartest.test
The __pillar__ dictionary holds the full pillar with all my custom values.
@adrianhj, thanks for the report. Do you know if this happens with normal minions as well?
Testing against a master/minion setup the module outlined above works as intended (i.e. it returns the fully populated pillar).
--versions-report is as follows:
Salt Version:
Salt: 2015.8.3
Dependency Versions:
Jinja2: unknown
M2Crypto: 0.20.2
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.5.0
Python: 2.6.6 (r266:84292, Nov 21 2013, 10:50:32)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.4.1
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: redhat 6.6 Santiago
machine: x86_64
release: 2.6.32-504.16.2.el6.x86_64
system: Red Hat Enterprise Linux Server 6.6 Santiago
@adrianhj, thanks for the confirmation.
May be related to #28503.
ZD-936
By experimenting with salt/client/ssh/__init__.py I was able to narrow this down a little bit. When run with salt-call, custom modules are loaded into the local context and are executed using run_wfunc(). Under salt-ssh functions are called using the method cmd.block():
def run(self, deploy_attempted=False):
...
elif self.fun in self.wfuncs or self.mine:
stdout, retcode = self.run_wfunc()
else:
stdout, stderr, retcode = self.cmd_block()
This second branch will execute the custom module from /tmp/.USER_XXXX_salt/running_data/var/cache/salt/minion/extmods/modules/ on the target machine. I don't yet see how to change the invocation of this module in order to include the pillar data.
Some further details; cmd_block() ultimately runs salt_call in a subprocess on the target machine:
/var/tmp/.USER_XXXXXX_salt/salt-call --retcode-passthrough --local --metadata --out json -l quiet
-c /var/tmp/.USER_XXXXXX_salt -- module.function
I just noticed that pillar.json is not deployed at all via salt-ssh.
@adrianhj: is this file deployed in your environment?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.