- Use SHA256 by default in master, minion and proxy (bsc#955373) Add: * 0036-Use-SHA256-hash-type-by-default.patch - Fix state structure compilation Add: * 0035-Fix-the-always-false-behavior-on-checking-state.patch - Fix git_pillar race condition Add: * 0034-Fix-git_pillar-race-condition.patch OBS-URL: https://build.opensuse.org/request/show/375270 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=64
68 lines
2.4 KiB
Diff
68 lines
2.4 KiB
Diff
From bb8048d4bd842746b09dbafe3a610e0d7c3e1bc2 Mon Sep 17 00:00:00 2001
|
|
From: Bo Maryniuk <bo@suse.de>
|
|
Date: Tue, 8 Mar 2016 16:00:26 +0100
|
|
Subject: [PATCH 35/35] Fix the always-false behavior on checking state
|
|
|
|
- Fix PEP8 continuation
|
|
- Keep first level away from lists.
|
|
- Adjust test
|
|
---
|
|
salt/utils/__init__.py | 15 +++++----------
|
|
tests/unit/utils/utils_test.py | 2 +-
|
|
2 files changed, 6 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py
|
|
index 5ee73b168349..8c8309e99f95 100644
|
|
--- a/salt/utils/__init__.py
|
|
+++ b/salt/utils/__init__.py
|
|
@@ -1741,7 +1741,7 @@ def gen_state_tag(low):
|
|
return '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}'.format(low)
|
|
|
|
|
|
-def check_state_result(running):
|
|
+def check_state_result(running, recurse=False):
|
|
'''
|
|
Check the total return value of the run and determine if the running
|
|
dict has any issues
|
|
@@ -1754,20 +1754,15 @@ def check_state_result(running):
|
|
|
|
ret = True
|
|
for state_result in six.itervalues(running):
|
|
- if not isinstance(state_result, dict):
|
|
- # return false when hosts return a list instead of a dict
|
|
+ if not recurse and not isinstance(state_result, dict):
|
|
ret = False
|
|
- if ret:
|
|
+ if ret and isinstance(state_result, dict):
|
|
result = state_result.get('result', _empty)
|
|
if result is False:
|
|
ret = False
|
|
# only override return value if we are not already failed
|
|
- elif (
|
|
- result is _empty
|
|
- and isinstance(state_result, dict)
|
|
- and ret
|
|
- ):
|
|
- ret = check_state_result(state_result)
|
|
+ elif result is _empty and isinstance(state_result, dict) and ret:
|
|
+ ret = check_state_result(state_result, recurse=True)
|
|
# return as soon as we got a failure
|
|
if not ret:
|
|
break
|
|
diff --git a/tests/unit/utils/utils_test.py b/tests/unit/utils/utils_test.py
|
|
index 611bfce0ed4b..261af69b59fc 100644
|
|
--- a/tests/unit/utils/utils_test.py
|
|
+++ b/tests/unit/utils/utils_test.py
|
|
@@ -406,7 +406,7 @@ class UtilsTestCase(TestCase):
|
|
('test_state0', {'result': True}),
|
|
('test_state', {'result': True}),
|
|
])),
|
|
- ('host2', [])
|
|
+ ('host2', OrderedDict([]))
|
|
]))
|
|
])
|
|
}
|
|
--
|
|
2.7.2
|
|
|