diff --git a/salt/minion.py b/salt/minion.py index 68733a508c5b..b4ad9d6956d6 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -1857,15 +1857,12 @@ def _target(cls, minion_instance, opts, data, connected, creds_map): uid = salt.utils.user.get_uid(user=opts.get("user", None)) minion_instance.proc_dir = get_proc_dir(opts["cachedir"], uid=uid) - def run_func(minion_instance, opts, data): + with salt.utils.ctx.request_context({"data": data, "opts": opts}): if isinstance(data["fun"], tuple) or isinstance(data["fun"], list): return Minion._thread_multi_return(minion_instance, opts, data) else: return Minion._thread_return(minion_instance, opts, data) - with salt.utils.ctx.request_context({"data": data, "opts": opts}): - run_func(minion_instance, opts, data) - def _execute_job_function( self, function_name, function_args, executors, opts, data ):