From 492367953648cbc789977869251285b8e0e1167b Mon Sep 17 00:00:00 2001 From: vzhestkov Date: Wed, 8 May 2024 12:57:28 +0200 Subject: [PATCH] Speed up salt.matcher.confirm_top by using __context__ --- salt/matchers/confirm_top.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/salt/matchers/confirm_top.py b/salt/matchers/confirm_top.py index 09a11ff428d..8bb1a77a392 100644 --- a/salt/matchers/confirm_top.py +++ b/salt/matchers/confirm_top.py @@ -22,7 +22,11 @@ def confirm_top(match, data, nodegroups=None): if "match" in item: matcher = item["match"] - matchers = salt.loader.matchers(__opts__) + if "matchers" in __context__: + matchers = __context__["matchers"] + else: + matchers = salt.loader.matchers(__opts__) + __context__["matchers"] = matchers funcname = matcher + "_match.match" if matcher == "nodegroup": return matchers[funcname](match, nodegroups)