After upgrading to salt-3007.8 and python 3.12 on some of our test salt clients, state apply was not longer possible. Also there is a deprication warning for python:
:/root#salt-call state.highstate
/opt/freeware/lib/python3.12/site-packages/salt/grains/core.py:2953: DeprecationWarning: datetime.datetime.utcnow() is depre cated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.date time.now(datetime.UTC).
start_time = datetime.datetime.utcnow()
/opt/freeware/lib/python3.12/site-packages/salt/utils/event.py:771: DeprecationWarning: datetime.datetime.utcnow() is deprec ated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datet ime.now(datetime.UTC).
data["_stamp"] = datetime.datetime.utcnow().isoformat()
/opt/freeware/lib/python3.12/site-packages/salt/utils/jid.py:19: DeprecationWarning: datetime.datetime.utcnow() is deprecate d and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime .now(datetime.UTC).
return datetime.datetime.utcnow()
local:
----------
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 local
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
After some reseach, my colleague found the reason in the file '/opt/freeware/lib/python3.12/site-packages/salt/utils/url.py'
In Line 49 and 50: url = salt.utils.data.decode(urlunparse(("file", "", path, "", query, "")))
return "salt://{}".format(url[len("file:///") :])
seems not supported by Python 3.12 and has to be replaced by:
return f'salt://{salt.utils.data.decode(urlunsplit(("", "", path, query, "")))}'
Found at https://github.com/gentoo/gentoo/blob/HEAD/app-admin/salt/files/salt-3007.1-python-3.13-urllib-parse.patch
This is needed if you have your salt states on git.
Kind regards,
Joerg
------------------------------
Joerg Kauke
Unix Administrator
COOP Switzerland
------------------------------