Open shtrom opened 2 days ago
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!
Local testing of PR #66894 fixes the issue for me!
Description
Similar to #29253,
state.sls_exists
doesn't work withsalt-ssh
. Likely just needs an implementation in the ssh client.I need it to implement conditional state inclusion, e.g., #16687 or #20010. I guess I could work around the issue bit creating a deterministic id in the state to detect, and use
state.sls_id
instead, but it's a bit more involved.Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
With a simple state file, e.g.,
test.sls
in a local setup as follows:Checking for state existence locally works.
But using the same setup via salt-ssh doesn't, and raises an exception when called from another state.
Both the local and remote machines are running ArchLinux.
Steps to Reproduce the behavior
See above for reproduction setup, debug output below.
sudo -E salt-ssh -l debug remote state.sls_exists test
``` [INFO ] Loading Saltfile from '/srv/salt/Saltfile' [DEBUG ] Reading configuration from /srv/salt/Saltfile [DEBUG ] Reading configuration from /srv/salt/conf/master [WARNING ] Insecure logging configuration detected! Sensitive data may be logged. [DEBUG ] Configuration file path: /srv/salt/conf/master [DEBUG ] The functions from module 'flat' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded flat.targets [DEBUG ] The functions from module 'jinja' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded jinja.render [DEBUG ] The functions from module 'yaml' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded yaml.render [DEBUG ] compile template: ./roster [DEBUG ] Jinja search path: ['/srv/salt/cache/salt/master/files/base'] [PROFILE ] Time (in seconds) to render './roster' using 'jinja' renderer: 0.0031299591064453125 [PROFILE ] Time (in seconds) to render './roster' using 'yaml' renderer: 0.0005714893341064453 [DEBUG ] The functions from module 'roster_matcher' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded roster_matcher.targets [DEBUG ] The functions from module 'roots' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded roots.envs [DEBUG ] The functions from module 's3fs' are being loaded by dir() on the loaded module [DEBUG ] Could not LazyLoad roots.init: 'roots.init' is not available. [DEBUG ] The functions from module 'local_cache' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded local_cache.prep_jid [DEBUG ] Adding minions for job 20240916103040419257: ['remote'] [DEBUG ] The functions from module 'state' are being loaded by dir() on the loaded module [DEBUG ] The functions from module 'cmd' are being loaded by dir() on the loaded module [DEBUG ] The functions from module 'config' are being loaded by dir() on the loaded module [DEBUG ] The functions from module 'cp' are being loaded by dir() on the loaded module [DEBUG ] The functions from module 'defaults' are being loaded by dir() on the loaded module [DEBUG ] Override __grains__:sudo -E salt-ssh -l debug remote state.apply test2t
``` [INFO ] Loading Saltfile from '/srv/salt/Saltfile' [DEBUG ] Reading configuration from /srv/salt/Saltfile [DEBUG ] Reading configuration from /srv/salt/conf/master [WARNING ] Insecure logging configuration detected! Sensitive data may be logged. [DEBUG ] Configuration file path: /srv/salt/conf/master [DEBUG ] The functions from module 'flat' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded flat.targets [DEBUG ] The functions from module 'jinja' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded jinja.render [DEBUG ] The functions from module 'yaml' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded yaml.render [DEBUG ] compile template: ./roster [DEBUG ] Jinja search path: ['/srv/salt/cache/salt/master/files/base'] [PROFILE ] Time (in seconds) to render './roster' using 'jinja' renderer: 0.003270387649536133 [PROFILE ] Time (in seconds) to render './roster' using 'yaml' renderer: 0.0006649494171142578 [DEBUG ] The functions from module 'roster_matcher' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded roster_matcher.targets [DEBUG ] The functions from module 'roots' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded roots.envs [DEBUG ] The functions from module 's3fs' are being loaded by dir() on the loaded module [DEBUG ] Could not LazyLoad roots.init: 'roots.init' is not available. [DEBUG ] In saltenv 'base', looking at rel_path '_modules/munin.py' to resolve 'salt://_modules/munin.py' [DEBUG ] In saltenv 'base', ** considering ** path '/srv/salt/cache/salt/master/files/base/_modules/munin.py' to resolve 'salt://_modules/munin.py' [DEBUG ] In saltenv 'base', looking at rel_path '_modules/utils.py' to resolve 'salt://_modules/utils.py' [DEBUG ] In saltenv 'base', ** considering ** path '/srv/salt/cache/salt/master/files/base/_modules/utils.py' to resolve 'salt://_modules/utils.py' [DEBUG ] In saltenv 'base', looking at rel_path '_modules/yay.py' to resolve 'salt://_modules/yay.py' [DEBUG ] In saltenv 'base', ** considering ** path '/srv/salt/cache/salt/master/files/base/_modules/yay.py' to resolve 'salt://_modules/yay.py' [DEBUG ] The functions from module 'local_cache' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded local_cache.prep_jid [DEBUG ] Adding minions for job 20240916105303800684: ['remote'] [DEBUG ] The functions from module 'state' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded state.apply [DEBUG ] Performing shimmed, blocking command as follows: test.opts_pkg [DEBUG ] Executed SHIM command. Command logged to TRACE [DEBUG ] Child Forked! PID: 1095258 STDOUT_FD: 9 STDERR_FD: 11 [DEBUG ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE [DEBUG ] RETCODE 192.168.103.24: 0 [DEBUG ] The functions from module 'roots' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded roots.envs [DEBUG ] The functions from module 's3fs' are being loaded by dir() on the loaded module [DEBUG ] Could not LazyLoad roots.init: 'roots.init' is not available. [DEBUG ] The functions from module 'jinja' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded jinja.render [DEBUG ] The functions from module 'yaml' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded yaml.render [DEBUG ] compile template: ./pillar/top.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render './pillar/top.sls' using 'jinja' renderer: 0.006115436553955078 [PROFILE ] Time (in seconds) to render './pillar/top.sls' using 'yaml' renderer: 0.0008871555328369141 [DEBUG ] The functions from module 'confirm_top' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded confirm_top.confirm_top [DEBUG ] The functions from module 'compound_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded compound_match.match [DEBUG ] compound_match: remote ? * [DEBUG ] The functions from module 'glob_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded glob_match.match [DEBUG ] compound_match remote ? "*" => "True" [DEBUG ] The functions from module 'compound_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded compound_match.match [DEBUG ] compound_match: remote ? *.oz.narf.ssji.net [DEBUG ] The functions from module 'glob_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded glob_match.match [DEBUG ] compound_match remote ? "*.oz.narf.ssji.net" => "False" [DEBUG ] The functions from module 'compound_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded compound_match.match [DEBUG ] compound_match: remote ? *.cav.narf.ssji.net [DEBUG ] The functions from module 'glob_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded glob_match.match [DEBUG ] compound_match remote ? "*.cav.narf.ssji.net" => "False" [DEBUG ] The functions from module 'compound_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded compound_match.match [DEBUG ] compound_match: remote ? supahwinch.narf.ssji.net [DEBUG ] The functions from module 'glob_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded glob_match.match [DEBUG ] compound_match remote ? "supahwinch.narf.ssji.net" => "False" [DEBUG ] The functions from module 'compound_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded compound_match.match [DEBUG ] compound_match: remote ? emile.narf.ssji.net [DEBUG ] The functions from module 'glob_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded glob_match.match [DEBUG ] compound_match remote ? "emile.narf.ssji.net" => "False" [DEBUG ] The functions from module 'compound_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded compound_match.match [DEBUG ] compound_match: remote ? PC-de-Martine.narf.ssji.net [DEBUG ] The functions from module 'glob_match' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded glob_match.match [DEBUG ] compound_match remote ? "PC-de-Martine.narf.ssji.net" => "False" [DEBUG ] compile template: ./pillar/console.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render './pillar/console.sls' using 'jinja' renderer: 0.001466989517211914 [PROFILE ] Time (in seconds) to render './pillar/console.sls' using 'yaml' renderer: 0.00026345252990722656 [DEBUG ] compile template: ./pillar/ddns.sls [DEBUG ] The functions from module 'gpg' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded gpg.render [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render './pillar/ddns.sls' using 'jinja' renderer: 0.001268625259399414 [PROFILE ] Time (in seconds) to render './pillar/ddns.sls' using 'yaml' renderer: 0.0003466606140136719 [DEBUG ] The functions from module 'config' are being loaded by dir() on the loaded module [DEBUG ] LazyLoaded config.get [DEBUG ] Reading GPG keys from: ./conf/gpgkeys [PROFILE ] Time (in seconds) to render './pillar/ddns.sls' using 'gpg' renderer: 0.21248221397399902 [DEBUG ] compile template: ./pillar/firewall.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render './pillar/firewall.sls' using 'jinja' renderer: 0.0036504268646240234 [PROFILE ] Time (in seconds) to render './pillar/firewall.sls' using 'yaml' renderer: 0.0033550262451171875 [DEBUG ] compile template: ./pillar/locale.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render './pillar/locale.sls' using 'jinja' renderer: 0.0020723342895507812 [PROFILE ] Time (in seconds) to render './pillar/locale.sls' using 'yaml' renderer: 0.0006067752838134766 [DEBUG ] compile template: ./pillar/mailhub.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render import_text 'secrets/abb_password.gpg': 0.0009849071502685547 [PROFILE ] Time (in seconds) to render './pillar/mailhub.sls' using 'jinja' renderer: 0.00430750846862793 [PROFILE ] Time (in seconds) to render './pillar/mailhub.sls' using 'yaml' renderer: 0.00036835670471191406 [DEBUG ] Reading GPG keys from: ./conf/gpgkeys [PROFILE ] Time (in seconds) to render './pillar/mailhub.sls' using 'gpg' renderer: 0.0010938644409179688 [DEBUG ] compile template: ./pillar/users.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [PROFILE ] Time (in seconds) to render import_text 'secrets/shtrom_htpasswd.gpg': 0.0008358955383300781 [PROFILE ] Time (in seconds) to render './pillar/users.sls' using 'jinja' renderer: 0.0049822330474853516 [PROFILE ] Time (in seconds) to render './pillar/users.sls' using 'yaml' renderer: 0.001547098159790039 [DEBUG ] Reading GPG keys from: ./conf/gpgkeys [PROFILE ] Time (in seconds) to render './pillar/users.sls' using 'gpg' renderer: 0.09530806541442871 [DEBUG ] compile template: ./pillar/munin/init.sls [DEBUG ] Jinja search path: ['./pillar', '/srv/salt/pillar'] [DEBUG ] Override __grains__:Expected behavior
... and no exception when called from another state.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ```yaml Salt Version: Salt: 3007.1 Python Version: Python: 3.10.14 (main, Jun 26 2024, 11:44:37) [GCC 11.2.0] Dependency Versions: cffi: 1.17.0 cherrypy: 18.10.0 dateutil: 2.9.0.post0 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.1.4 libgit2: Not Installed looseversion: 1.3.0 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.8 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 24.1 pycparser: 2.22 pycrypto: Not Installed pycryptodome: 3.20.0 pygit2: Not Installed python-gnupg: 0.5.2 PyYAML: 6.0.2 PyZMQ: 26.2.0 relenv: 0.17.0 smmap: Not Installed timelib: 0.3.0 Tornado: 6.4.1 ZMQ: 4.3.5 Salt Package Information: Package Type: Not Installed System Versions: dist: arch locale: utf-8 machine: x86_64 release: 6.9.10-arch1-1 system: Linux version: Arch Linux ```