-
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 87.66% 84.69% -2.98%
==========================================
Files 33 35 +2
Lines 1549 1647 +98
==========================================
+ Hits 1358 1395 +37
- Misses 191 252 +61 ☔ 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.
8223bc1
to
5eea9cf
Compare
Signed-off-by: Tobias Wolf <[email protected]>
5eea9cf
to
0f14ce7
Compare
What this PR does / why we need it:
This PR adds support to interact with a local podman installation.