-
Notifications
You must be signed in to change notification settings - Fork 2
Add support to interact with a local podman installation #211
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
base: main
Are you sure you want to change the base?
Conversation
6d29503 to
9aff29a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
==========================================
- Coverage 90.22% 89.83% -0.40%
==========================================
Files 42 44 +2
Lines 1995 2223 +228
==========================================
+ Hits 1800 1997 +197
- Misses 195 226 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9aff29a to
41c4a3a
Compare
| if logger is None or not logger.hasHandlers(): | ||
| logger = LoggerSetup.get_logger("gardenlinux.oci") | ||
|
|
||
| self._logger = logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we try to use loguru instead (https://loguru.readthedocs.io/en/stable/overview.html#ready-to-use-out-of-the-box-without-boilerplate)? Standard logger requires so much dancing and results in a bunch of repeated code in many files.
| if logger is None or not logger.hasHandlers(): | ||
| logger = LoggerSetup.get_logger("gardenlinux.oci") | ||
|
|
||
| self._logger = logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This boilerplate can be avoided had we used loguru :)
| def _wait_for_socket(self, sock: str): | ||
| """ | ||
| Waits for the socket file to be created. | ||
|
|
||
| :since: 0.11.0 | ||
| """ | ||
|
|
||
| sock_path = Path(sock) | ||
|
|
||
| for _ in range(0, 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS): | ||
| if sock_path.exists(): | ||
| break | ||
|
|
||
| sleep(0.2) | ||
|
|
||
| if not sock_path.exists(): | ||
| raise TimeoutError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def _wait_for_socket(self, sock: str): | |
| """ | |
| Waits for the socket file to be created. | |
| :since: 0.11.0 | |
| """ | |
| sock_path = Path(sock) | |
| for _ in range(0, 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS): | |
| if sock_path.exists(): | |
| break | |
| sleep(0.2) | |
| if not sock_path.exists(): | |
| raise TimeoutError() | |
| @retry(stop_max_delay=PODMAN_CONNECTION_MAX_IDLE_SECONDS) | |
| def _wait_for_socket(self, sock: str): | |
| if not Path(sock).is_socket(): | |
| raise Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests. I've also added some suggestions.
5eea9cf to
0f14ce7
Compare
4d6fba8 to
01a90ec
Compare
9ac0ae9 to
0b95980
Compare
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
0b95980 to
584de78
Compare
What this PR does / why we need it:
This PR adds support to interact with a local podman installation.