From 2e53699cc1821d7a4a55957d62ccb20b1d69cb34 Mon Sep 17 00:00:00 2001 From: water <672684719@qq.com> Date: Mon, 17 Aug 2026 15:42:00 +0800 Subject: [PATCH] fix: initialize self.tok on sub-proxies to prevent AttributeError Sub-proxies are constructed via ProxyMinion(proxyopts) directly in subproxy_post_master_init and never run connect_master, so self.tok is never set by the usual master-connection path. Any event path that references self.tok (e.g. _fire_master_prepare, _register_resources, _mine_send) raises AttributeError. Setting tok=None is safe because the channel layer's _package_load regenerates the token via self.auth.gen_token(b"salt") on every send, overwriting whatever value was in the load dict. Fixes #70071 --- salt/metaproxy/deltaproxy.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/salt/metaproxy/deltaproxy.py b/salt/metaproxy/deltaproxy.py index cb2b8e2c9a09..b2c3c053e9d5 100644 --- a/salt/metaproxy/deltaproxy.py +++ b/salt/metaproxy/deltaproxy.py @@ -463,6 +463,12 @@ async def subproxy_post_master_init(minion_id, uid, opts, main_proxy, main_utils ) _proxy_minion = ProxyMinion(proxyopts) + # Sub-proxies never run connect_master, so self.tok + # is never set by the usual master-connection path. + # Initialize to None to prevent AttributeError in + # paths that reference self.tok. The tok is + # regenerated by the channel layer on send anyway. + _proxy_minion.tok = None _proxy_minion.proc_dir = salt.minion.get_proc_dir(proxyopts["cachedir"], uid=uid) # And load the modules