saltstack / saltstack/salt

[BUG] roster_defaults does not apply to targets absent from roster

Open
#58,440 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
The roster_defaults key in the master config lets you set default values for targets. However, these defaults only get applied to targets that are in the roster, and not targets that are not in the roster. This is a bit confusing, because salt-ssh works just fine otherwise if you provide a target that is an explicit hostname.

Setup
This is easiest to demonstrate with an example where roster_defaults sets the port to something non-default that breaks. And two hosts listed and unlisted, only the first of which is explicitly listed in the roster.

roster

listed: {}

master

roster_defaults:
  port: 9999

Steps to Reproduce the behavior

  1. salt-ssh listed test.ping fails with an error, as expected (because nothing is listening on port 9999):
listed:
    ssh: connect to host listed port 9999: Connection refused
  1. salt-ssh unlisted test.ping does not fail, it works just fine:
unlisted.example.com:
    True

Expected behavior
I would expect the unlisted target to apply the port setting from roster_defaults and fail the same way as the listed target.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
           Salt: 3001.1

Dependency Versions:
           cffi: 1.14.2
       cherrypy: Not Installed
       dateutil: 2.8.1
      docker-py: 4.1.0
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.11.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: 1.1.2
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.20
       pycrypto: Not Installed
   pycryptodome: 3.9.7
         pygit2: Not Installed
         Python: 3.8.5 (default, Aug  2 2020, 15:09:07)
   python-gnupg: Not Installed
         PyYAML: 5.3.1
          PyZMQ: 19.0.2
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: debian testing bullseye
         locale: utf-8
        machine: x86_64
        release: 5.7.0-3-amd64
         system: Linux
        version: Debian GNU/Linux testing bullseye

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the salt-ssh target-resolution entry point and trace how roster_defaults is applied to listed and explicit unlisted targets. Reproduce the behavior with the provided roster and master configurations, then add coverage showing that both targets honor the configured port and produce the expected failure.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.