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] 3007.1 unable to locate top.sls (or any sls) #67097

Open
ephreal opened this issue Dec 13, 2024 · 6 comments
Open

[BUG] 3007.1 unable to locate top.sls (or any sls) #67097

ephreal opened this issue Dec 13, 2024 · 6 comments
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@ephreal
Copy link

ephreal commented Dec 13, 2024

Description
Salt is unable to locate any *.sls files when attempting to apply a state. This includes top.sls when running salt 'minion' state.apply, or any other files that you may have made and try run - such as salt 'minion' state.apply linux/all for linux configuration that should apply to all Linux minions.

Setup

To install saltstack, I used the package manager for Archlinux

sudo pacman -S salt

After installation, I modified two lines in the salt minion configuration

# /etc/salt/minion
# Lines up to line 16 removed
master: salt.example.com
# Lines up to line 112 removed
id: minion
# No further changes

I also modified three lines in the salt master configuration

# /etc/salt/master
# Lines up to line 28 removed
# Running as the root user to remove any permissions issues
user: root
# Lines up to 698 removed
file_roots:
  base:
    - /srv/salt
    - /etc/letsencrypt

Additionally, I have tested this on several different devices. I disabled the firewalls on both during testing.

Raspberry pi - Running Archlinux ARM
Intel server - Running Archlinux

These devices are both physically present here on my network.

Once configured, I enabled and started the services with systemctl. I was able to accept the key for the minion and ping it.

[root@master salt]# salt 'minion' test.ping
minion:
    True

Steps to Reproduce the behavior
Install saltstack. Create a top.sls file in /srv/salt/. Attempt to run salt '*' state.apply. Receive the following error.

minion:
----------
          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 minion
------------
Succeeded: 0
Failed:    1

Expected behavior
I expected the salt minion to receive the top.sls from the master and begin applying the states.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

I've included the versions on both the raspberry pi and the Intel server. The salt master and salt minion are on the same version.

Intel server

Salt Version: Salt: 3007.1

Python Version:
Python: 3.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910]

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.9.0
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: 0.40.1
Mako: Not Installed
msgpack: 1.0.5
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.1
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.20.0
pygit2: Not Installed
python-gnupg: Not Installed
PyYAML: 6.0.2
PyZMQ: 25.1.2
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 6.4.1
ZMQ: 4.3.5

Salt Package Information:
Package Type: Not Installed

System Versions:
dist: arch
locale: utf-8
machine: x86_64
release: 6.11.6-arch1-1
system: Linux
version: Arch Linux

PASTE HERE

Raspberry pi

Salt Version: Salt: 3007.1

Python Version:
Python: 3.12.7 (main, Oct 11 2024, 23:49:56) [GCC 14.1.1 20240507]

Dependency Versions:
cffi: 1.17.1
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: 0.40.1
Mako: Not Installed
msgpack: 1.0.5
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.2
pycparser: 2.22
pycrypto: Not Installed
pycryptodome: 3.21.0
pygit2: Not Installed
python-gnupg: Not Installed
PyYAML: 6.0.2
PyZMQ: 25.1.2
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 6.4.1
ZMQ: 4.3.5

Salt Package Information:
Package Type: Not Installed

System Versions:
dist: archarm
locale: utf-8
machine: armv7l
release: 6.12.4-1-rpi
system: Linux
version: Arch Linux ARM

Additional context

This is particularly puzzling to me. Saltstack is clearly able to locate the files.

[root@master salt]# pwd
/srv/salt

[root@master salt]# ls
# The README is here since I store my salt config in git
README.md  clients  linux  top.sls  windows

[root@master salt]# salt-run fileserver.file_list
# Snipping for brevity and to keep my domain names from leaking
# The important thing is, this is clearly locating files, including top.sls
# snipped
- linux/all/burp/burp.conf
- linux/all/etc/fail2ban/jail.local
- linux/all/etc/init.sls
- linux/all/etc/iptables/autopkg-agent.sls
- linux/all/etc/iptables/autopkg-server.sls
- linux/all/etc/iptables/default_deny.sls
- linux/all/etc/iptables/dhcp_server.sls
- linux/all/etc/iptables/dns_client.sls
# snipped some more
- top.sls
- windows/all/init.sls
- windows/all/packages.sls
- windows/all/zabbix/init.sls
# end of the output

When attempting to run any state, I get an error.

[root@master salt]# salt 'minion' state.apply --state-output=mixed
minion:
----------
          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 minion
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms

[root@master salt]# salt 'minion' state.apply linux/all/etc
minion:
    Data failed to compile:
----------
    No matching sls found for 'linux/all/etc' in env 'base'
ERROR: Minions returned with non-zero exit code

This happens whether or not I clone my repo for /etc/salt or create a fresh /etc/salt directory and a new top.sls (or any other *.sls). salt-run fileserver.file_list will print out the appropriate files, and salt 'minion' state.apply filename.sls fails to run it.

# set /srv/salt to be the only file_root in /etc/salt/master
# Created a new /srv/salt directory
# Created packages.sls in /srv/salt

[root@master salt]# pwd
/srv/salt

[root@master salt]# ls
packages.sls

[root@master salt]# cat packages.sls 
update_packages:
  pkg.uptodate:
    - refresh: True

[root@master salt]# salt-run fileserver.file_list
- packages.sls

[root@master salt]# salt 'minion' state.apply packages
minion:
    Data failed to compile:
----------
    No matching sls found for 'packages' in env 'base'
ERROR: Minions returned with non-zero exit code

If anyone has any ideas on what more I can provide, or things I can try, I'm willing to provide or try them.

@ephreal ephreal added Bug broken, incorrect, or confusing behavior needs-triage labels Dec 13, 2024
@whytewolf
Copy link
Collaborator

whytewolf commented Dec 18, 2024

try salt 'minion' cp.list_master this will give you what the filesystem looks like from the minions side.

it sounds like currently the minion is unable to access the salt masters file system. but without more context that is difficult to know for sure.

also check the minions log file.

@ephreal
Copy link
Author

ephreal commented Dec 20, 2024

Is there any context that would help? I'd like to figure out what the root cause on this one is.

try salt 'minion' cp.list_master this will give you what the filesystem looks like from the minions side.

[root@master salt]# pwd
/srv/salt
[root@master salt]# salt 'minion' test.ping
minion:
    True
[root@master salt]# salt 'minion' cp.list_master
minion:
    - packages.sls
[root@master salt]# ls
packages.sls

@whytewolf
Copy link
Collaborator

yes it is helpful. but with that attitude I'm not going to tell you why and I'm done trying to help.

@lkubb
Copy link
Contributor

lkubb commented Dec 20, 2024

It's very likely #66898.

@ephreal
Copy link
Author

ephreal commented Dec 20, 2024

yes it is helpful. but with that attitude I'm not going to tell you why and I'm done trying to help.

You do you, I wasn't giving any attitude. The only one doing that here is you. I'm genuinely interested in figuring out what's going on here.

It's very likely #66898.

Thanks, I'll wait and see what happen on that one.

@hansat299
Copy link

Hi,
I have got a similar issue as the description indicates. It reproduces the same behavior and when I try to run any state it gives the same error.

After upgrading my system from nixos 24.05 to 24.11 the issue occurred. The upgrade of the salt package is from 3007.0 to 3007.1. It uses python version 3.12.7. The issue blocks processing of salt states for a number of systems.

I'm happy to share version report, configuration and logs in another issue report if needed for further analysis.

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 needs-triage
Projects
None yet
Development

No branches or pull requests

4 participants