salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] Parsing issue with GitFS remotes causes master to fail (3006.12 and 3007.4)

Open jlrcontegix opened this issue 7 months ago • 2 comments

Description salt-master fails to start if GitFS remotes are formatted in a particular way.

If we format our remotes like this, salt-master fails to start:

- [email protected]:stuff/stuff.git:

The following WARNING and ERROR are produced:

2025-06-12 18:42:27,795 [salt.utils.gitfs :2654][WARNING ][3637192] Found bad url data '[email protected]:stuff/stuff.git'
2025-06-12 17:12:30,436 [salt._logging.impl:1082][ERROR   ][3581238] An un-handled exception was caught by Salt's global exception handler:
StopIteration:
Traceback (most recent call last):
  File "/usr/bin/salt-master", line 11, in <module>
    sys.exit(salt_master())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/scripts.py", line 86, in salt_master
    master.start()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/daemons.py", line 203, in start
    self.master.start()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/master.py", line 704, in start
    self._pre_flight()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/master.py", line 641, in _pre_flight
    fileserver.init()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__init__.py", line 530, in init
    self.servers[fstr]()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/gitfs.py", line 168, in init
    _gitfs()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/gitfs.py", line 83, in _gitfs
    return salt.utils.gitfs.GitFS(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 3216, in __new__
    super(GitFS, obj).__init__(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 2588, in __init__
    self.init_remotes(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 2667, in init_remotes
    repo_obj = self.git_providers[self.provider](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 1418, in __init__
    super().__init__(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 315, in __init__
    self.id = next(iter(remote))
StopIteration

If we change the original format to this one, salt-master starts and operates normally:

- ssh://[email protected]/stuff/stuff.git:

According to https://docs.saltproject.io/en/3006/topics/tutorials/gitfs.html both should be valid.

Setup Install salt-master 3006.12 or 3007.4 on Rocky 8 and configure a gitfs_remote as described above.

Steps to Reproduce the behavior Configure a gitfs_remote as such: - [email protected]:stuff/stuff.git:

Expected behavior Both syntax used should be valid.

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

Versions Report

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

Python Version:
        Python: 3.10.17 (main, Jun  9 2025, 20:41:48) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.17.1
      cherrypy: unknown
  cryptography: 42.0.5
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: 4.0.11
     gitpython: 3.1.44
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.19.3
         smmap: 5.0.1
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: rocky 8.10 Green Obsidian
        locale: utf-8
       machine: x86_64
       release: 4.18.0-553.54.1.el8_10.x86_64
        system: Linux
       version: Rocky Linux 8.10 Green Obsidian

Additional context

jlrcontegix avatar Jun 13 '25 00:06 jlrcontegix

I'm also facing the same issue after updating from 3006.10 to 3006.12 on my salt master.

TobiPeterG avatar Jun 13 '25 08:06 TobiPeterG

This also affects git_pillar. After the workaround I then hit #68072.

OrangeDog avatar Jun 13 '25 08:06 OrangeDog

The workaround did not working for me. The exception went away and it didn't complain when I ran salt-run fileserver.update, but when I checked the directory the debug logs said it downloaded into it was empty.

The only fix that worked for me was to roll back to 3006.11.

NinjaSomething avatar Jun 16 '25 22:06 NinjaSomething

It seems I faced the same issue in our git_pillar/gitstack setup. In our case, after the upgrade to 3006.12 the previously working config started to fail with:

2025-06-17 09:32:29,713 [salt.utils.gitfs ][WARNING ]  Found bad url data 'master  https://git.server/SALT/ssl-certs.git'

The catch here was the extra space between master and URL, which was added for alignment reasons. That used to work for over 6 years, but broke with the last update. Removing extra space fixed the error. (But not GitFS handling in the 3006.12, which is another ticket).

b-a-t avatar Jun 17 '25 10:06 b-a-t

I think this has been fixed by #68089

twangboy avatar Jun 30 '25 21:06 twangboy