salt
salt copied to clipboard
[BUG] Python renderer fails with attribute error when run under salt-ssh
Description
Python renderer fails with attribute error when run under salt-ssh
but functions correctly when run with salt
/salt-call
on 3007.0, 3006.7 and 3006.4.
Setup
Virtual machines running Debian with salt installed from salt package repository.
Please be as specific as possible and give set-up details.
- [x] on-prem machine
- [x] VM (Virtualbox, KVM, etc. please specify)
- [ ] 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
- [ ] classic packaging
- [x] onedir packaging
- [ ] used bootstrap to install
Steps to Reproduce the behavior
- Place
cp_fail.sls
in root of fileserver.
#!py
def run():
__salt__.cp.get_file_str("salt://cp_fail.sls", saltenv="base")
return {}
- run
salt-call state.apply cp_fail test=true
- run
salt-ssh <host> state.apply cp_fail test=true
Expected behavior
salt-call
and salt-ssh
render the same state without error.
Screenshots Example of salt-call
# salt-call state.apply cp_fail test=true
local:
Summary for local
-----------
Succeeded: 0
Failed: 0
-----------
Total states run: 0
Total run time: 0.000 ms
Example of salt-ssh
# salt-ssh --priv=/root/.ssh/saltmaster_id_rsa host1.*******.*** state.apply cp_fail test=true
[INFO ] Fetching file from saltenv 'base', ** done ** 'cp_fail.sls'
[CRITICAL] Rendering SLS 'base:cp_fail' failed: Traceback (most recent call last):
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/templates.py", line 690, in py
data = mod.run()
File "/var/tmp/.root_caa0bf_salt/running_data/var/cache/salt/minion/files/base/cp_fail.sls", line 4, in run
__salt__.cp.get_file_str("salt://cp_fail.sls", saltenv="base")
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 123, in __getattr__
return getattr(self.value(), name)
AttributeError: 'FunctionWrapper' object has no attribute 'cp'
host1.*******.***:
- Rendering SLS 'base:cp_fail' failed: Traceback (most recent call last):
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/templates.py", line 690, in py
data = mod.run()
File "/var/tmp/.root_caa0bf_salt/running_data/var/cache/salt/minion/files/base/cp_fail.sls", line 4, in run
__salt__.cp.get_file_str("salt://cp_fail.sls", saltenv="base")
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 123, in __getattr__
return getattr(self.value(), name)
AttributeError: 'FunctionWrapper' object has no attribute 'cp'
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)# salt --versions-report
Salt Version:
Salt: 3007.0
Python Version:
Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
Dependency Versions:
cffi: 1.16.0
cherrypy: unknown
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.3
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.7
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 23.1
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.5.2
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: 0.15.1
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.3.3
ZMQ: 4.3.4
Salt Package Information:
Package Type: onedir
System Versions:
dist: debian 11.9 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-28-amd64
system: Linux
version: Debian GNU/Linux 11.9 bullseye
Additional context n/a