mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Ensure exit_json returns failed = False
This is required for modules that may return a non-zero `rc` value for a successful run, similar to #24865 for Windows fixing **win_chocolatey**. We also disable the dependency on `rc` value only, even if `failed` was set. Adapted unit and integration tests to the new scheme. Updated raw, shell, script, expect to take `rc` into account.
This commit is contained in:
parent
1f78715848
commit
0e160d5c7e
17 changed files with 68 additions and 56 deletions
|
@ -81,7 +81,7 @@ class TestAnsibleModuleExitJson(unittest.TestCase):
|
|||
else:
|
||||
self.assertEquals(ctx.exception.code, 1)
|
||||
return_val = json.loads(self.fake_stream.getvalue())
|
||||
self.assertEquals(return_val, dict(msg="message", failed=True, invocation=empty_invocation))
|
||||
self.assertEquals(return_val, dict(msg="message", changed=False, failed=True, invocation=empty_invocation))
|
||||
|
||||
def test_exit_json_proper_changed(self):
|
||||
with self.assertRaises(SystemExit) as ctx:
|
||||
|
@ -143,7 +143,6 @@ class TestAnsibleModuleExitValuesRemoved(unittest.TestCase):
|
|||
self.maxDiff = None
|
||||
for args, return_val, expected in self.dataset:
|
||||
expected = copy.deepcopy(expected)
|
||||
del expected['changed']
|
||||
expected['failed'] = True
|
||||
params = dict(ANSIBLE_MODULE_ARGS=args)
|
||||
params = json.dumps(params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue