[BUG] salt-ssh no longer applies roster defaults to hosts not explicitly listed in the roster
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
used to be able to just run salt-ssh against any host using the configured roster defaults by hostname. at some point in the recent past, this has broken, so now all hosts have to be manually defined in the roster file.
Setup
Steps to Reproduce the behavior
- run
salt-sshagainst a host not explicitly defined in the roster file - watch it not use the roster defaults and fail
roster_defaults:
priv: agent-forwarding
sudo: True
tty: True
user: tessa
$ salt-ssh testhost state.apply
[DEBUG ] LazyLoaded roster_matcher.targets
[DEBUG ] Matched minions: {}
[DEBUG ] LazyLoaded roots.envs
[DEBUG ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG ] Updating roots fileserver cache
[DEBUG ] In saltenv 'base', looking at rel_path '_grains/dirs.py' to resolve 'salt://_grains/dirs.py'
[DEBUG ] In saltenv 'base', ** considering ** path '/tmp/.salt-root/var/cache/salt/master/files/base/_grains/dirs.py' to resolve 'salt://_grains/dirs.py'
[DEBUG ] LazyLoaded local_cache.prep_jid
[DEBUG ] Adding minions for job 20210128041157634134: ['c1.sudo.prv']
[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: 1560248 STDOUT_FD: 11 STDERR_FD: 13
[DEBUG ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE
[DEBUG ] RETCODE c1.sudo.prv: 255
[DEBUG ] SHIM retcode(255) and command:
Permission denied for host testhost, do you want to deploy the salt-ssh key? (password required):
testhost:
----------
_error:
Failed to return clean data
retcode:
255
stderr:
root@testhost: Permission denied (publickey,password).
stdout:
Expected behavior
I expected it to use my username and sudo to run the states against the remote host. not just try root and fail.
Versions Report
salt --versions-report
```yaml Salt Version: Salt: 3002.2Dependency Versions:
cffi: 1.14.3
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: 4.3.1
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.2
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.1.4
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: 2.6.1
pycryptodome: 3.9.8
pygit2: Not Installed
Python: 3.8.6 (default, Sep 25 2020, 09:36:53)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 19.0.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.10 groovy
locale: utf-8
machine: x86_64
release: 5.8.0-40-lowlatency
system: Linux
version: Ubuntu 20.10 groovy
</details>
**Additional context**
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with salt-ssh against a hostname absent from the roster, using the shown roster_defaults configuration. Start at the roster_matcher.targets path visible in the debug output and trace how an unmatched host is assembled. Done means the host receives the configured user, sudo, tty, and privilege settings instead of attempting root access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100