Skip to content
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

Capture sanity check warnings and display them #3214

Merged
merged 1 commit into from Aug 31, 2021
Merged

Capture sanity check warnings and display them #3214

merged 1 commit into from Aug 31, 2021

Conversation

ssbarnea
Copy link
Member

Captures runtime warnings raise by driver.sanity_check() and
display them at the end in case of failure.

Related: ansible-community/molecule-podman#76

src/molecule/util.py Outdated Show resolved Hide resolved
src/molecule/util.py Outdated Show resolved Hide resolved
src/molecule/api.py Outdated Show resolved Hide resolved
result = util.run_command(self._ansible_command, debug=self._config.debug)
with warnings.catch_warnings(record=True) as warns:
warnings.filterwarnings("default", category=MoleculeRuntimeWarning)
self._config.driver.sanity_checks()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only catch warnings coming from this invocation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what is happening with record, when the context is destroyed the filter is also reset. At least that is what docs are saying.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that we shouldn't suppress those warnings in run_command()

Captures runtime warnings raise by driver.sanity_check() and
display them at the end in case of failure.

Related: ansible-community/molecule-podman#76
@ssbarnea ssbarnea merged commit cc8f128 into main Aug 31, 2021
@ssbarnea ssbarnea deleted the fix/warns branch August 31, 2021 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants