2023-05-05 11:15:58 +02:00
From b0e713d6946526b894837406c0760c262e4312a1 Mon Sep 17 00:00:00 2001
2019-01-17 10:18:02 +01:00
From: Bo Maryniuk <bo@suse.de>
Date: Wed, 9 Jan 2019 16:08:19 +0100
Subject: [PATCH] Fix issue #2068 test
Skip injecting `__call__` if chunk is not dict.
This also fixes `integration/modules/test_state.py:StateModuleTest.test_exclude` that tests `include` and `exclude` state directives containing the only list of strings.
Minor update: more correct is-dict check.
---
salt/state.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/salt/state.py b/salt/state.py
2023-05-05 11:15:58 +02:00
index 8352a8defc..cb434a91e7 100644
2019-01-17 10:18:02 +01:00
--- a/salt/state.py
+++ b/salt/state.py
2021-01-08 13:41:50 +01:00
@@ -12,6 +12,7 @@ The data sent to the state calls is as follows:
"""
2019-01-17 10:18:02 +01:00
2021-01-08 13:41:50 +01:00
+import collections
import copy
import datetime
import fnmatch
2023-05-05 11:15:58 +02:00
@@ -3507,16 +3508,18 @@ class State:
2021-01-08 13:41:50 +01:00
"""
2019-01-17 10:18:02 +01:00
for chunk in high:
state = high[chunk]
+ if not isinstance(state, collections.Mapping):
+ continue
for state_ref in state:
needs_default = True
+ if not isinstance(state[state_ref], list):
+ continue
for argset in state[state_ref]:
2021-01-08 13:41:50 +01:00
if isinstance(argset, str):
2019-01-17 10:18:02 +01:00
needs_default = False
break
if needs_default:
- order = state[state_ref].pop(-1)
2021-01-08 13:41:50 +01:00
- state[state_ref].append("__call__")
2019-01-17 10:18:02 +01:00
- state[state_ref].append(order)
2021-01-08 13:41:50 +01:00
+ state[state_ref].insert(-1, "__call__")
2019-01-17 10:18:02 +01:00
def call_high(self, high, orchestration_jid=None):
2021-01-08 13:41:50 +01:00
"""
2019-01-17 10:18:02 +01:00
--
2023-05-05 11:15:58 +02:00
2.39.2
2019-01-17 10:18:02 +01:00