Remove salt.utils.data from fileserver

The salt.utils.data util was used to support python 2. Since we no
longer support python 2, we can start removing this. This gives us
some great speed increases as we're removing a lot of overhead and
unnecessary function calls
This commit is contained in:
twangboy 2024-08-26 11:16:33 -06:00 committed by Daniel Wozniak
parent 72bb50cb27
commit f0e2cf4689

View file

@ -11,7 +11,6 @@ import time
from collections.abc import Sequence
import salt.loader
import salt.utils.data
import salt.utils.files
import salt.utils.path
import salt.utils.url
@ -147,13 +146,7 @@ def check_file_list_cache(opts, form, list_cache, w_lock):
opts.get("fileserver_list_cache_time", 20),
list_cache,
)
return (
salt.utils.data.decode(
salt.payload.load(fp_).get(form, [])
),
False,
False,
)
return salt.payload.load(fp_).get(form, []), False, False
elif _lock_cache(w_lock):
# Set the w_lock and go
refresh_cache = True
@ -189,7 +182,7 @@ def check_env_cache(opts, env_cache):
try:
with salt.utils.files.fopen(env_cache, "rb") as fp_:
log.trace("Returning env cache data from %s", env_cache)
return salt.utils.data.decode(salt.payload.load(fp_))
return salt.payload.load(fp_)
except OSError:
pass
return None