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

[TECH DEBT] Salt fails to load top.sls on Python3.13rc2 #66898

Open
marmarek opened this issue Sep 18, 2024 · 2 comments · May be fixed by #66899
Open

[TECH DEBT] Salt fails to load top.sls on Python3.13rc2 #66898

marmarek opened this issue Sep 18, 2024 · 2 comments · May be fixed by #66899

Comments

@marmarek
Copy link
Contributor

Description of the tech debt to be addressed, include links and screenshots

A recent change in Python 3.13 causes salt to fails on loading top.sls. With debugging enabled, I see now:

[DEBUG   ] Could not find file 'salt://.sls' in saltenv 'base'
[DEBUG   ] No contents loaded for saltenv 'base'

This seems to be directly caused by the change in Python: python/cpython#85110

Old behavior:

>>> urllib.parse.urlunparse(("file", "", "top.sls", "", "", ""))
'file:///top.sls'

New behavior:

>>> urllib.parse.urlunparse(("file", "", "top.sls", "", "", ""))
'file:top.sls'

Technically, I think the latter might be more correct. But it still breaks salt's expectations. Specifically here:

salt/salt/utils/url.py

Lines 49 to 50 in 246d066

url = salt.utils.data.decode(urlunparse(("file", "", path, "", query, "")))
return "salt://{}".format(url[len("file:///") :])

With file:top.sls, looking for length of file:/// is wrong now.

Versions Report

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

Salt Version:
          Salt: 3006.9
 
Python Version:
        Python: 3.13.0rc2 (main, Sep  7 2024, 00:00:00) [GCC 14.2.1 20240801 (Red Hat 14.2.1-1)]
 
Dependency Versions:
          cffi: 1.17.0
      cherrypy: Not Installed
  cryptography: Not Installed
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.1
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.20.0
        pygit2: Not Installed
  python-gnupg: Not Installed
        PyYAML: 6.0.1
         PyZMQ: 25.1.1
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: Not Installed
           ZMQ: 4.3.5
 
System Versions:
          dist: qubes 4.3 R4.3
        locale: utf-8
       machine: x86_64
       release: 6.6.48-1.qubes.fc41.x86_64
        system: Linux
       version: Qubes OS 4.3 R4.3

The same issue applies to Fedora 41 (in beta now). And while I tested using Salt 3006.9, the relevant code is the same in master.

@ptitdoc
Copy link

ptitdoc commented Sep 18, 2024

Take care that as if is related to cython it's independent from python3.13.

I have the same bug (and same fix working) for python 3.12.6/cython 3.0.11

@marmarek
Copy link
Contributor Author

Indeed Python 3.12.6 is affected too, and so is Fedora 40 and 39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants