Skip to content

Conversation

NotTheEvilOne
Copy link
Contributor

What this PR does / why we need it:
This PR adds support to interact with a local podman installation.

@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 2 times, most recently from 6d29503 to 9aff29a Compare October 2, 2025 08:54
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 39.00000% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.69%. Comparing base (6ba28d5) to head (8223bc1).

Files with missing lines Patch % Lines
src/gardenlinux/oci/podman_context.py 36.50% 40 Missing ⚠️
src/gardenlinux/oci/podman.py 36.36% 21 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch from 9aff29a to 41c4a3a Compare October 2, 2025 09:14
Comment on lines +36 to +40
if logger is None or not logger.hasHandlers():
logger = LoggerSetup.get_logger("gardenlinux.oci")

self._logger = logger
Copy link
Contributor

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.

Comment on lines +46 to +49
if logger is None or not logger.hasHandlers():
logger = LoggerSetup.get_logger("gardenlinux.oci")

self._logger = logger
Copy link
Contributor

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 :)

Comment on lines +128 to +144
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()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Contributor

@vivus-ignis vivus-ignis left a 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.

@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch 3 times, most recently from 8223bc1 to 5eea9cf Compare October 3, 2025 14:42
@NotTheEvilOne NotTheEvilOne force-pushed the feature/oci-podman-interaction branch from 5eea9cf to 0f14ce7 Compare October 3, 2025 14:46
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.

2 participants