8000 Ensure subprocesses are run via Runtime() by ssbarnea · Pull Request #3237 · ansible/molecule · GitHub
[go: up one dir, main page]

Skip to content
< 8000 /div>

Ensure subprocesses are run via Runtime() - #3237

Merged
ssbarnea merged 1 commit into
mainfrom
fix/stuff
Jan 12, 2022
Merged

ssbarnea merged 1 commit into
mainfrom
fix/stuff

Conversation

@ssbarnea
@ssbarnea ssbarnea commented Sep 13, 2021 •
Copy link
Copy Markdown
Member

Instead of directly calling subprocess, ensure we use Runtime
api methods for running various commands, most importantly
ansible commands.

This also removes subprocess-tee dependency as a desired action.

@ssbarnea ssbarnea added the bug label Sep 13, 2021
@ssbarnea
ssbarnea marked this pull request as draft September 13, 2021 11:51
@webknjaz
Copy link
Copy Markdown
Member

Idea: we could forbid calling subprocess via pylint.

@ssbarnea
ssbarnea force-pushed the fix/stuff branch 4 times, most recently from cb19121 to 5aa02e6 Compare January 11, 2022 14:39
@ssbarnea
ssbarnea marked this pull request as ready for review January 11, 2022 14:45
@ssbarnea
Copy link
Copy Markdown
Member Author

Idea: we could forbid calling subprocess via pylint.
We can do this in follow-up, I am trying to make this PR as small as possible.

@ssbarnea
ssbarnea requested a review from ganeshrn January 11, 2022 15:04
Comment thread src/molecule/app.py
self.runtime = Runtime(isolated=True)


app = App()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this an attempt to make a mutable singleton? Why not initialize it during the startup sequence and then pass around DI-style?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Molecule multi-layered structure makes it extremely inconvenient to pass such an object. I considered that approach but it would be a total mess. We can aim to achieve that at some point but it would need several major version changes and existence of plugins is a major limiting factor.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Affecting the import time is also messy. There's nothing wrong with multilayered bypasses, though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I will not do that as part of this PR. If you want you can lead this challenge but I warn you that you will unlikely to succeed as you will have to change API of plugins and 15+ plugins. I am also worried that this may add delays which may interfere with AAP inclusion goals.

Comment thread setup.cfg Resolved
@ssbarnea
Copy link
Copy Markdown
Member Author

@webknjaz @ganeshrn: I do not plan to merge this until I release 1.0.0 or ansible-compat, but the release of compat is waiting for the approval of this PR as I want to avoid having to patch it in case we miss something.

Please review it and let me know if I can release compat.

@ssbarnea
ssbarnea force-pushed the fix/stuff branch 2 times, most recently from d2fd1f5 to 72f6a1a Compare January 11, 2022 17:03
@ssbarnea
ssbarnea requested a review from apatard January 12, 2022 11:14
Instead of directly calling subprocess, ensure we use Runtime
api methods for running various commands, most importantly
ansible commands.

This also removes subprocess-tee dependency as a desired action.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0