mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
properly clean up the fileclient in extmods
This commit is contained in:
parent
834337373c
commit
7ff9a899d9
3 changed files with 15 additions and 14 deletions
|
@ -1460,6 +1460,12 @@ class RemoteClient(Client):
|
|||
load["tok"] = self.auth.gen_token(b"salt")
|
||||
return self.channel.send(load)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.destroy()
|
||||
|
||||
|
||||
class FSClient(RemoteClient):
|
||||
"""
|
||||
|
|
|
@ -541,12 +541,6 @@ class AsyncReqMessageClient:
|
|||
if self.context.closed is False:
|
||||
self.context.term()
|
||||
|
||||
# pylint: disable=W1701
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
||||
# pylint: enable=W1701
|
||||
|
||||
def _init_socket(self):
|
||||
if hasattr(self, "stream"):
|
||||
self.stream.close() # pylint: disable=E0203
|
||||
|
|
|
@ -81,15 +81,16 @@ def sync(opts, form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None)
|
|||
cache = []
|
||||
log.info("Loading cache from %s, for %s", source, sub_env)
|
||||
# Grab only the desired files (.py, .pyx, .so)
|
||||
cache.extend(
|
||||
fileclient.cache_dir(
|
||||
source,
|
||||
sub_env,
|
||||
include_empty=False,
|
||||
include_pat=r"E@\.(pyx?|so|zip)$",
|
||||
exclude_pat=None,
|
||||
with fileclient:
|
||||
cache.extend(
|
||||
fileclient.cache_dir(
|
||||
source,
|
||||
sub_env,
|
||||
include_empty=False,
|
||||
include_pat=r"E@\.(pyx?|so|zip)$",
|
||||
exclude_pat=None,
|
||||
)
|
||||
)
|
||||
)
|
||||
local_cache_dir = os.path.join(
|
||||
opts["cachedir"], "files", sub_env, "_{}".format(form)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue