saltstack / saltstack/salt

[BUG] Unable to Check a Minion(s) local Environment Variables.

Open
#59,488 3 comments 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
Unable to execute environment variables from salt-master across salt-minions.
Trying to have each of my minions echo out their hostname variables through a salt command has them each just posting the hostname of the Master.

Steps to Reproduce the behavior
Any salt command trying to display simply any environment variable across minions; however, I chose to use this one:

sudo salt -N 'dev' cmd.run "echo '$HOSTNAME'"

Expected behavior
I understand the way saltstack works with the master is where it is configuring the command first on the master, and then telling the minions to execute that command; however, in a circumstance like this, I was expecting each of the minions to display their hostname. I saw online some far more difficult ways of doing what I want with salt grains, but that seems far too long of a setup just for a simple request.

Screenshot
saltenv

Additional context
I understand that there are other ways to receive the hostname for the minions; however, the example above is just an example of the inability to utilize minion(s) environment variables throughout saltstack, not necessarily me trying to get this specific information in the most efficient way possible. The issue originally occurred with me trying to execute a sed command across all minions and replacing something within a file found within all of my servers to match their respective environment variables; however, I found that instead they were all replaced with the environment variable found on the salt-master node instead.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3002.2
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.6.1
     docker-py: Not Installed
         gitdb: 2.0.3
     gitpython: 2.1.8
        Jinja2: 2.10.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: 2.6.1
  pycryptodome: 3.4.7
        pygit2: Not Installed
        Python: 3.6.9 (default, Oct  8 2020, 12:12:24)
  python-gnupg: 0.4.1
        PyYAML: 3.12
         PyZMQ: 17.1.2
         smmap: 2.0.3
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.5
 
System Versions:
          dist: ubuntu 18.04 Bionic Beaver
        locale: UTF-8
       machine: x86_64
       release: 4.15.0-135-generic
        system: Linux
       version: Ubuntu 18.04 Bionic Beaver```
</details>

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 by reproducing the reported sudo salt -N 'dev' cmd.run "echo '$HOSTNAME'" command and compare where the variable is expanded. The issue names no source file or test, so trace the command execution path before deciding whether the behavior needs a fix or clearer documentation. Done means the intended environment-variable behavior is established and verified for minions.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, shell
Domain
cli, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.