Skip to content

Commit

Permalink
fixes saltstack#62398 enable to executive remote file client methods …
Browse files Browse the repository at this point in the history
…in saltcheck
  • Loading branch information
nicholasmhughes committed Sep 20, 2022
1 parent 2c8088f commit e940879
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion salt/modules/saltcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,12 +747,20 @@ def _call_salt_command(self, fun, args, kwargs):
"""
Generic call of salt Caller command
"""
# remote functions and modules won't work with local file client
# these aren't exhaustive lists, so add to them when a module or
# function can't operate without the remote file client
remote_functions = ["file.check_managed_changes"]
remote_modules = ["cp"]
mod = fun.split(".", maxsplit=1)[0]

conf_file = __opts__["conf_file"]
local_opts = salt.config.minion_config(conf_file)
# Save orginal file_client to restore after salt.client.Caller run
orig_file_client = local_opts["file_client"]
mlocal_opts = copy.deepcopy(local_opts)
mlocal_opts["file_client"] = "local"
if fun not in remote_functions and mod not in remote_modules:
mlocal_opts["file_client"] = "local"
value = False
if args and kwargs:
value = salt.client.Caller(mopts=mlocal_opts).cmd(fun, *args, **kwargs)
Expand Down

0 comments on commit e940879

Please sign in to comment.