saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.13k stars 5.47k forks source link

[BUG] all_saltenvs is ignored by disable_saltenv_mapping #61522

Open OrangeDog opened 2 years ago

OrangeDog commented 2 years ago

Description When using formulas, for example, you usually want all of your saltenvs to use the same version of the formula, but it's also good to reduce the number of saltenvs that are automatically detected but will never be used. It appears that this should be possible, but it doesn't work well, as all_saltenvs doesn't count as "per-saltenv configuration parameters".

Setup

gitfs_remotes:
  - https://github.com/saltstack-formulas/apt-formula:
    - all_saltenvs: v0.10.2
    - disable_saltenv_mapping: true
  - https://github.com/private/saltstack:
    - root: salt

Steps to Reproduce the behavior Attempt to apply a state that uses the formula

Expected behavior Regardless of the applied saltenv (base, prod, 'test`, etc.), it should use the git tag as configured for the formula. Instead there are no mappings at all.

Versions Report

salt --versions-report ``` Salt Version: Salt: 3004 Dependency Versions: cffi: 1.14.5 cherrypy: Not Installed dateutil: 2.7.3 docker-py: Not Installed gitdb: 2.0.6 gitpython: 3.0.7 Jinja2: 2.10.1 libgit2: 1.3.0 M2Crypto: 0.31.0 Mako: Not Installed msgpack: 0.6.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.20 pycrypto: Not Installed pycryptodome: 3.6.1 pygit2: 1.7.1 Python: 3.8.10 (default, Nov 26 2021, 20:14:08) python-gnupg: 0.4.5 PyYAML: 5.3.1 PyZMQ: 18.1.1 smmap: 2.0.5 timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.2 System Versions: dist: ubuntu 20.04 focal locale: utf-8 machine: x86_64 release: 5.4.0-96-generic system: Linux version: Ubuntu 20.04 focal ```

Additional context If you want to increase performance with disable_saltenv_mapping then you have to map every single saltenv manually, and change it whenever a new one is added.

gitfs_remotes:
  - https://github.com/saltstack-formulas/apt-formula:
    - base: v0.10.2
    - saltenv:
       - prod:
         - ref: v0.10.2
       - test:
         - ref: v0.10.2
       - pre-release:
         - ref: v0.10.2
        # ...
    - disable_saltenv_mapping: true
  - https://github.com/private/saltstack:
    - root: salt
OrangeDog commented 2 years ago

Similarly, saltenv_blacklist overrides all_saltenvs, and none of the files are visible to a state.apply.

Using saltenv_whitelist also doesn't work. While v0.10.2 is listed in fileserver.envs, the contents do not appear in fileserver.dir_list

- all_saltenvs: v0.10.2
- saltenv_whitelist: [ v0.10.2 ]
garethgreenaway commented 1 year ago

Assuming this is still a valid issue.