salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] saltenv variable always equals `base` in reactor SLS

Open faivirol opened this issue 3 years ago • 2 comments

Description The saltenv variable is always set to base in reactor SLSs, even when the reactor SLS is loaded from another environment.

Setup master.conf:

reactor:
  - '<some tag>':
    - salt://reactor/mysls?saltenv=myenv

/reactor/mysls.sls:

<id>:
  runner.state.orchestrate:
    - args:
      - mods: orch.myorch
      - saltenv: "{{ saltenv }}"  # This always results in the orchestration SLS from `base` being loaded according to the debug logs. Directly setting it to `myenv` works as expected.

Expected behavior saltenv should be equal to the environment where the reactor SLS was loaded from (myenv in the above). Alternatively, if these are not related in the way I assume they are, another variable should be provided so the saltenv can be propagated automatically.

Versions Report

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

Dependency Versions:
          cffi: 1.15.1
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: 1.5.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.16.0
        pygit2: 1.11.1
        Python: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 20.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.3

System Versions:
          dist: ubuntu 22.04 Jammy Jellyfish
        locale: utf-8
       machine: aarch64
       release: 5.15.0-1028-aws
        system: Linux
       version: Ubuntu 22.04 Jammy Jellyfish

faivirol avatar Feb 01 '23 12:02 faivirol

I'm facing the same issue. I'm trying to develop a reactor and runner, I execute this on my minion: salt-call state.apply saltenv=salt-master-config

with git as remote filesystem automatically mapping branches to environments. On the master, however, I see this: Jun 03 10:52:58 salt salt-master[286679]: [ERROR ] Unable to cache file 'salt://_reactor/hostkey_manage.sls' from saltenv 'base'. Jun 03 10:52:58 salt salt-master[286679]: [ERROR ] Can not render SLS for tag salt/auth. File missing or not found.

The file exists on the salt-master-config branch.

TobiPeterG avatar Jun 03 '25 10:06 TobiPeterG

Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.

Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.

If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.

dwoz avatar Oct 16 '26 01:10 dwoz