ansiblegate: take care of failed, skipped and unreachable tasks and propagate "retcode"#58214
Conversation
| NO_PYTEST = not bool(pytest) | ||
|
|
||
|
|
||
| @skipIf(NO_PYTEST, False) |
There was a problem hiding this comment.
Just cosmetic request to drop the redundant NO_PYTEST constant. Other tests are using pytest directly in skipIf
@skipIf(pytest is None, "PyTest is missing")|
@meaksh thank you for contribution. Could you please follow up just one cosmetic change request? |
|
@DmitryKuzmenko I've pushed the changes you requested. Thanks for reviewing! 👍 |
| assert ret == {"completed": True, "timeout": 1200} | ||
|
|
||
|
|
||
| @patch("salt.utils.path.which", MagicMock(return_value=True)) |
There was a problem hiding this comment.
Could you please move this mock object into the function level scope. Having mocks in the module level scope could produce issues.
There was a problem hiding this comment.
Ok, good to know, thanks! I've pushed the requested changes 👍
There was a problem hiding this comment.
Oh wait, I missed few of them. 1 sec.
There was a problem hiding this comment.
Ok, it should be ready now.
|
Looks good now. Thank you for update. |
|
@meaksh why are you marking all skipped tasks as outstanding? this behavior terminates the application of the state with an error |
|
Hey @denis-khalturin-incountry, I don't really get what you mean. Could you please elaborate that and provide some examples? Thanks in advance! |
|
@meaksh yes of course. i am applying playbook: One of the tasks is skipped according to the conditions: But if I start playbook by applying state, I get an error when executing playbook: I think this is the wrong handling of skipped tasks |
|
Thanks for clarifying @denis-khalturin-incountry ! You're totally right 👍 I did some checks here and can confirm that Could you please create a new issue so we can hopefully produce a fix soon? Thanks in advance! |
|
Yes, I will create an issue. Thanks |
What does this PR do?
This PR fixes few issues on the
ansiblegateexecution and state modules when running playbooks:ansible.playbooksto allow proper success/failed detection.ansible-playbook --checkin test mode (test=True) to allow running playbooks that are using modules which does not allow--check.What issues does this PR fix or reference?
Fixes: #57854
Fixes: #57855
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.