Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] state.test does not work with salt-ssh #61100

Open
Timmeeh opened this issue Oct 22, 2021 · 1 comment · Fixed by #65517
Open

[BUG] state.test does not work with salt-ssh #61100

Timmeeh opened this issue Oct 22, 2021 · 1 comment · Fixed by #65517
Assignees
Labels
Bug broken, incorrect, or confusing behavior pending-community-assignment Pending community contributor assignment Salt-SSH severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@Timmeeh
Copy link

Timmeeh commented Oct 22, 2021

Description
salt-ssh target state.test does not work, while salt-ssh target state.apply test=True does work

Setup
Using salt-ssh to run against some specific targets that cannot run minions. Initially noted on WSL with Debian 10 and salt 3004, but confirmed to be at least also the case for salt 3001 and 3002.

Steps to Reproduce the behavior
Using this Dockerfile to create an environment of Debian 10 with salt 3004. Test target is latest Ubuntu focal EC2 instance

Dockerfile
FROM debian:10

RUN apt-get update && \
	apt-get install -y curl openssh-server nano && \
	curl -fsSL -o /usr/share/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/py3/debian/10/amd64/3004/salt-archive-keyring.gpg && \
	echo "deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/py3/debian/10/amd64/3004 buster main" | tee /etc/apt/sources.list.d/salt.list && \
	apt-get update && apt-get install -y salt-ssh 

# ssh configuration
RUN mkdir /root/.ssh
COPY config /root/.ssh/config
COPY keys/* /root/.ssh/
RUN chmod 600 /root/.ssh/*

COPY roster /etc/salt/roster

RUN mkdir /srv/salt

COPY salt/foo.sls /srv/salt/
COPY salt/top.sls /srv/salt/
roster
aws:
  host: XXX.compute.amazonaws.com
  user: ubuntu

top.sls

base:
  '*':
    - foo

foo.sls

/tmp/foo:
    file.touch

Expected behavior
state.test should be equivalent to state.apply test=true

Actual result

# salt-ssh -i aws state.apply test=true
aws:
----------
          ID: /tmp/foo
    Function: file.touch
      Result: True
     Comment: File /tmp/foo exists and has the correct times
     Started: 12:42:05.344433
    Duration: 34.264 ms
     Changes:
              ----------
              new:
                  /tmp/foo

Summary for aws
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:  34.264 ms
# salt-ssh -i aws state.test
aws:
----------
          ID: states
    Function: no.None
      Result: False
     Comment: No Top file or master_tops data matches found. Please see master log for details.
     Changes:

Summary for aws
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms
debug output
[DEBUG   ] Missing configuration file: /etc/salt/master
[DEBUG   ] Using importlib_metadata to load entry points
[DEBUG   ] Override  __grains__: <module 'salt.loaded.int.log_handlers.sentry_mod' from '/usr/lib/python3/dist-packages/salt/log/handlers/sentry_mod.py'>
[DEBUG   ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] LazyLoaded flat.targets
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] compile template: /etc/salt/roster
[DEBUG   ] Jinja search path: ['/var/cache/salt/master/files/base']
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG   ] Updating roots fileserver cache
[PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'jinja' renderer: 0.028995990753173828
[DEBUG   ] Rendered data from file: /etc/salt/roster:
aws:
  host: XXX.compute.amazonaws.com
  user: ubuntu

[DEBUG   ] Results of YAML rendering:
OrderedDict([('aws', OrderedDict([('host', 'XXX.compute.amazonaws.com'), ('user', 'ubuntu')]))])
[PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'yaml' renderer: 0.0013532638549804688
[DEBUG   ] LazyLoaded roster_matcher.targets
[DEBUG   ] Matched minions: {'aws': {'host': 'XXX.compute.amazonaws.com', 'user': 'ubuntu'}}
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG   ] Updating roots fileserver cache
[DEBUG   ] Unable to list dir: /srv/salt/top.sls
[DEBUG   ] Unable to list dir: /srv/salt/foo.sls
[DEBUG   ] LazyLoaded local_cache.prep_jid
[DEBUG   ] Adding minions for job 20211022132016268531: ['aws']
[DEBUG   ] Override  __grains__: <module 'salt.loaded.int.wrapper.grains' from '/usr/lib/python3/dist-packages/salt/client/ssh/wrapper/grains.py'>
[DEBUG   ] Could not LazyLoad state.test: 'state.test' is not available.
[DEBUG   ] Performing shimmed, blocking command as follows:
state.test
[DEBUG   ] Executed SHIM command. Command logged to TRACE
[DEBUG   ] Child Forked! PID: 148  STDOUT_FD: 10  STDERR_FD: 12
[DEBUG   ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE
[DEBUG   ] RETCODE XXX.compute.amazonaws.com: 2
[DEBUG   ] Using importlib_metadata to load entry points
[DEBUG   ] LazyLoaded highstate.output
/var/log/salt/ssh
2021-10-22 13:20:16,157 [salt.utils.verify:591 ][WARNING ][117] Insecure logging configuration detected! Sensitive data may be logged.

Versions Report

salt --versions-report
Salt Version:
          Salt: 3004

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10
       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: Not Installed
  pycryptodome: 3.6.1
        pygit2: Not Installed
        Python: 3.7.3 (default, Jan 22 2021, 20:04:44)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.1.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: debian 10 buster
        locale: utf-8
       machine: x86_64
       release: 4.15.0-140-generic
        system: Linux
       version: Debian GNU/Linux 10 buster

Additional context
Note 1: when installing salt-master in the container (and running it interactively), salt-minion on the target and connecting them, salt the_minion state.test does work.

Note 2: also state.show_states doesn't show any output when used through salt-ssh, while state.show_top does

@Timmeeh Timmeeh added Bug broken, incorrect, or confusing behavior needs-triage labels Oct 22, 2021
@OrangeDog OrangeDog added Salt-SSH severity-low 4th level, cosemtic problems, work around exists and removed needs-triage labels Oct 26, 2021
@OrangeDog OrangeDog added this to the Approved milestone Oct 26, 2021
@cmcmarrow cmcmarrow added the pending-community-assignment Pending community contributor assignment label Sep 8, 2023
@NotSqrt
Copy link
Contributor

NotSqrt commented Jan 9, 2024

Can confirm that pip install salt==3007.0rc1 fixed salt-ssh target state.test !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior pending-community-assignment Pending community contributor assignment Salt-SSH severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants