5af0dfb7fe
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=189
53 lines
1.7 KiB
Diff
53 lines
1.7 KiB
Diff
From 1ea573fe35245ab08eb26a757d373ca16c841a1c Mon Sep 17 00:00:00 2001
|
|
From: Alberto Planas <aplanas@suse.com>
|
|
Date: Tue, 27 Apr 2021 14:01:43 +0200
|
|
Subject: [PATCH] transactional_update: detect recursion in the
|
|
executor (#359)
|
|
|
|
---
|
|
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
|
|
|
|
|