-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
localhost wait_for does not return a failure nor exception #1941
Comments
The sonic-mgmt version that works in this case is based on master.0-3ab4b716. Output of
|
@wangxin , can you take a look? |
This is a complicated and tricky issue. There are multiple problems behind this issue. Firstly, for your specific case, please check if you can directly issue The other issue is within pytest_ansible "ansible/pytest-ansible#47 The For some reason I don't know yet, ansible removes the keys like 'failed' and 'skipped' in failed test result dict before calling the callback functions of ansible plugins. Ansible calls different callback functions for succeeded and failed ansible module results. However, the pytest_ansible plugin uses the same callback function for both succeeded and failed ansible modules. So, in case an ansible module failed, the pytest_ansible is only able to tell if it is failed only when the module result dict has key 'rc' with non-zero value. A PR "#1786 Workaround for no Exception issue for some failed ansible modules" has been submitted as a workaround for this issue. PR #17686 enhanced the sonic-mgmt library to consider any ansible module result with 'exception' field as failed. But the problem is still not fully resolved. In some cases, result of If we run wait_for on localhost and on duthost, the results may be different:
The log:
The log:
Both results have On sonic-mgmt docker:
On duthost:
According to the implementation of wait_for, if we wait for ssh port of a reachable host to be 'stopped', the module will call module.fail_json to return failed result. The wait_for module itself does not add 'exception' field in such results: https://github.com/ansible/ansible/blob/v2.8.7/lib/ansible/modules/utilities/logic/wait_for.py#L559 The 'exception' field is added by the module.fail_json method: https://github.com/ansible/ansible/blob/v2.8.7/lib/ansible/module_utils/basic.py#L2064 According to the logic, when traceback is generated while executing the ansible module, an The Depending on 'exception' field in the ansible module result is not reliable enough. To fully fix the problem, there are two options:
It seems that option 2 would be easier. |
Description
Steps to reproduce the issue:
Describe the results you received:
localhost.wait_for does not give a way to know if there was a failure.
Describe the results you expected:
localhost.wait_for sets is_failed flag or adds 'exception' into res.
Additional information you deem important:
Previous version of sonic-mgmt docker image has localhost.wait_for working and wait_for set 'exception' in result. Recent sonic-mgmt docker image broke this.
The text was updated successfully, but these errors were encountered: