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

Add support for container initialization #491

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

vmsh0
Copy link
Contributor

@vmsh0 vmsh0 commented Jan 5, 2025

In reference to my issue #490, I have drafted a patch to add support for the operation.

I have performed some trivial manual testing of the change, but trying to run tox results in the log line below repeating indefinitely, and as such I have not run the various testing facilities that the project provides.

If anyone would be able to help me to get the tests running, I would be more than happy to also contribute additional coverage for this new method.

------------------------------------------------------------------------------- live log call --------------------------------------------------------------------------------
2025-01-05 18:10:08 [    INFO] Launching(5.3.1) podman --log-level=info system service --time=0 unix:///tmp/tmpqcq78j4c/ad527583baab4ebb96975b65cda25702 refid=1483129501152721076 (utils.py:86)
2025-01-05 18:10:08 [   DEBUG] Starting new HTTP connection (1): localhost:22 (connectionpool.py:241)
2025-01-05 18:10:08 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)
2025-01-05 18:10:08 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)
2025-01-05 18:10:08 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)
2025-01-05 18:10:08 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)
2025-01-05 18:10:09 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)
2025-01-05 18:10:09 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)
2025-01-05 18:10:09 [   DEBUG] Waiting on /run/user/1000/podman/podman-forward-4cad89234a116ac037aa.sock (ssh.py:89)

@jwhonce
Copy link
Member

jwhonce commented Jan 7, 2025

@vmsh0 The line
2025-01-05 18:10:08 [ INFO] Launching(5.3.1) podman --log-level=info system service --time=0 unix:///tmp/tmpqcq78j4c/ad527583baab4ebb96975b65cda25702 refid=1483129501152721076 (utils.py:86)
is attempting to start an instance of the podman service for the tests to run against. The Waiting on lines are where the podman-py client is attempting to connect to that instance. What I do not see is why podman failed to start.

@vmsh0
Copy link
Contributor Author

vmsh0 commented Jan 10, 2025

The issue is resolved. That log was from the test that uses ssh to loopback the podman socket file to a different location in the filesystem. It simply required suitable ssh and permissions setup.

I have updated my PR to include a unit test and an integration test for the new feature. Also a small docstring fix in a related place.

@vmsh0 vmsh0 force-pushed the container-init branch 2 times, most recently from 69ae03c to 4e79592 Compare January 10, 2025 16:40
This commit contributes support for container initialization (i.e., the
operation performed by `podman container init`.)

Alongside that, it introduces:
- unit test ContainersTestCase::test_init
- integration subtest `Create-Init-Start Container` in
  ContainersIntegrationTest::test_container_crud

A small fix to the docstring of Container.status has also been
contributed to reflect the existance of the `created` and `initialized`
states.

Signed-off-by: Riccardo Paolo Bestetti <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Jan 14, 2025

Thanks @vmsh0
/approve
LGTM

@jwhonce @umohnani8 PTAL

@inknos inknos self-requested a review January 15, 2025 14:28
@inknos
Copy link
Contributor

inknos commented Jan 15, 2025

Thanks! @vmsh0 if you are interested fixing man podman-ps too adding the status initialized to the --filter option, you are very welcome to :) containers/podman#25017

/approve
/lgtm

Copy link
Contributor

openshift-ci bot commented Jan 15, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inknos, rhatdan, vmsh0

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@inknos
Copy link
Contributor

inknos commented Jan 15, 2025

Fixes: #490

@openshift-merge-bot openshift-merge-bot bot merged commit c792857 into containers:main Jan 15, 2025
16 checks passed
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.

4 participants