File transactional_update-detect-recursion-in-the-executo.patch of Package salt
From c08d3e194794d91d46abb585e3734c76825882cb Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@suse.com>
Date: Tue, 27 Apr 2021 14:00:58 +0200
Subject: [PATCH] transactional_update: detect recursion in the
executor (#357)
---
salt/executors/transactional_update.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/salt/executors/transactional_update.py b/salt/executors/transactional_update.py
index ef7d92bc05..0fa83d730b 100644
--- a/salt/executors/transactional_update.py
+++ b/salt/executors/transactional_update.py
@@ -5,6 +5,8 @@ Transactional executor module
"""
+import os
+
import salt.utils.path
# Functions that are mapped into an equivalent one in
@@ -98,6 +100,8 @@ def execute(opts, data, func, args, kwargs):
add_delegated_functions: [file.copy]
"""
+ inside_transaction = os.environ.get("TRANSACTIONAL_UPDATE")
+
fun = data["fun"]
module, _ = fun.split(".")
@@ -114,11 +118,13 @@ def execute(opts, data, func, args, kwargs):
delegated_modules |= set(opts.get("add_delegated_modules", []))
delegated_functions |= set(opts.get("add_delegated_functions", []))
- if fun in DELEGATION_MAP:
+ if fun in DELEGATION_MAP and not inside_transaction:
result = __executors__["direct_call.execute"](
opts, data, __salt__[DELEGATION_MAP[fun]], args, kwargs
)
- elif module in delegated_modules or fun in delegated_functions:
+ elif (
+ module in delegated_modules or fun in delegated_functions
+ ) and not inside_transaction:
result = __salt__["transactional_update.call"](fun, *args, **kwargs)
else:
result = __executors__["direct_call.execute"](opts, data, func, args, kwargs)
--
2.31.1