saltstack / saltstack/salt

"salt-ssh --roster dir ..." ignores "roster_defaults" master configuration option

Open
#63,015 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage Salt-SSH
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

salt-ssh ignores the master configuration option "roster_defaults" when using a directory roster (--roster dir).
When using a flat file roster (--roster flat) the master configuration option "roster_defaults" is working.

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Flat file roster:

[root@endeavourvm ~]# cat /etc/salt/roster
endeavourvm: 
  host: 192.168.122.193

Directory roster:

[root@endeavourvm ~]# cat /etc/salt/roster.d/endeavourvm 
host: 192.168.122.193

From master configuration file /etc/salt/master

roster_defaults:
  thin_dir: /tmp/salt-thin_dir

Steps to Reproduce Issue

Comment out any roster_defaults in /etc/salt/master

# roster_defaults:
#   thin_dir: /tmp/salt-thin_dir

Call salt-ssh with "--roster flat"

[root@endeavourvm ~]# salt-ssh --roster flat endeavourvm  config.option thin_dir
/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
endeavourvm:
    /var/tmp/.root_d39a06_salt

Call salt-ssh with "--roster dir"

[root@endeavourvm ~]# salt-ssh --roster dir endeavourvm  config.option thin_dir
/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
endeavourvm:
    /var/tmp/.root_d39a06_salt

Note that thin_dir has the default setting with roster_defaults commented out -> Ok

Comment in roster_defaults configuration in /etc/salt/master.
In this case I want to have "thin_dir: /tmp/salt-thin_dir" for all my minions

roster_defaults:
  thin_dir: /tmp/salt-thin_dir

Call salt-ssh with "--roster flat" again

[root@endeavourvm ~]# salt-ssh --roster flat endeavourvm  config.option thin_dir
/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
endeavourvm:
    /tmp/salt-thin_dir

Note that thin_dir now reflects the setting from roster_defaults in /etc/salt/master

Call salt-ssh with "--roster dir" again

[root@endeavourvm ~]# salt-ssh --roster dir endeavourvm  config.option thin_dir
/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
endeavourvm:
    /var/tmp/.root_d39a06_salt

Note that thin_dir still has the default setting and not the setting from roster_defaults in /etc/salt/master

Versions Report
[root@endeavourvm ~]# salt --versions-report
/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Salt Version:
          Salt: 3005.1
 
Dependency Versions:
          cffi: 1.15.1
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
      M2Crypto: 0.38.0
          Mako: Not Installed
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.12.0
        pygit2: Not Installed
        Python: 3.10.8 (main, Oct 13 2022, 21:13:48) [GCC 12.2.0]
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 24.0.1
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: endeavouros rolling rolling
        locale: utf-8
       machine: x86_64
       release: 6.0.6-arch1-1
        system: Linux
       version: EndeavourOS rolling rolling

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 with the salt-ssh entry point and reproduce the difference between --roster flat and --roster dir using the roster_defaults and thin_dir configuration shown here. Compare how both roster modes load these settings, then add regression coverage showing that a directory roster uses /tmp/salt-thin_dir when configured and retains the default when it is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.