Merge pull request #38340 from ewapptus/bp-38251

Backport PR #38251: Fixed nested orchestrate not respecting failures
This commit is contained in:
Mike Place 2016-12-19 06:31:14 -07:00 committed by GitHub
commit 15d3b476e9
4 changed files with 32 additions and 0 deletions

View file

@ -394,6 +394,8 @@ class SyncClientMixin(object):
with tornado.stack_context.StackContext(self.functions.context_dict.clone):
data['return'] = self.functions[fun](*args, **kwargs)
data['success'] = True
if 'data' in data['return']:
data['success'] = salt.utils.check_state_result(data['return']['data'])
except (Exception, SystemExit) as ex:
if isinstance(ex, salt.exceptions.NotImplemented):
data['return'] = str(ex)

View file

@ -0,0 +1,6 @@
cmd.run:
salt.function:
- tgt: minion
- arg:
- /bin/false
- failhard: True

View file

@ -0,0 +1,10 @@
state.orchestrate:
salt.runner:
- mods: nested-orch.inner
- failhard: True
cmd.run:
salt.function:
- tgt: minion
- arg:
- touch /tmp/ewu-2016-12-13

View file

@ -68,6 +68,20 @@ class StateRunnerTest(integration.ShellCase):
for item in good_out:
self.assertIn(item, ret_output)
def test_orchestrate_nested(self):
'''
test salt-run state.orchestrate and failhard with nested orchestration
'''
if os.path.exists('/tmp/ewu-2016-12-13'):
os.remove('/tmp/ewu-2016-12-13')
_, code = self.run_run(
'state.orchestrate nested-orch.outer',
with_retcode=True)
self.assertFalse(os.path.exists('/tmp/ewu-2016-12-13'))
self.assertNotEqual(code, 0)
def test_state_event(self):
'''
test to ensure state.event