-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
generate_systemd don't work for a pod #491
Comments
As you need to define all the pods, containers, and their dependencies, before generating the systemd files; Something like a module named |
Agree, we need a new module for this. |
Maybe I can do it ? Any requirement for this new module ? |
Would be great. You can use one of modules as an example. Like podman save/load or login/logout modules. I'll help with it if need. |
Do I have tests to write ? If yes, what system do you use ? |
You can write tests just as sequence of tasks, their execution in GH jobs are little bit tricky, I need to describe it properly. For now you can add them here: https://github.com/containers/ansible-podman-collections/tree/master/tests/integration/targets |
Ok, I started to work on it. How does the module have to act, in case the user specify an option only available in podman 4.0.0 and above ? |
And which minimum version of Python do I target ? |
About Python version - I'd keep compatible with Python 3.6.8 as it's highest version available on CentOS 7. This module shouldn't be too complex, so worth to have it compatible as possible.
|
Ok, I got a working module, tested with a container. :) I need to test it with a pod, write the doc, the integration test and I can do a pull request. I will do it later or tomorrow. |
thanks for doing this, will be very useful for me |
With which user these tests are run ? |
Do I test every features of the module or only the generation of systemd units and its writing into a file ? |
With a regular user. If you need tests for root containers as well, use ansible-podman-collections/tests/integration/targets/podman_pod/tasks/main.yml Lines 821 to 827 in 9c1cd62
Usually all test roles are executed from here: https://github.com/containers/ansible-podman-collections/tree/master/ci/playbooks/containers
Better to test all arguments you pass to the module and see it they are applied. And w/o arguments, just a default run. You can see as an example: ansible-podman-collections/tests/integration/targets/podman_container/tasks/main.yml Lines 583 to 614 in 03f19df
|
Ok, I'm close to do the pull request. I try to run When I run: ansible-test integration podman_generate_systemd
PS: Do I remove the systemd generate option from |
Ho, I get it. The path need to be |
@CyberFox001 I don't use |
After I moved the project directory at the path ansible-test integration podman_generate_systemd Add all my tests pass. :D So, now I will do the lasts commits. Do I need to remove the systemd generate option from |
Great, maybe worth to do it in CI as well 😆 Let's leave these functions for now. |
Ok, I make the pull request. |
pull request done: #498 |
|
So, after the checks run, all the sanity check have errors. The first sanity check have 2 problems: My name and a TypeError. For the first one, is it because of the accent in my first name ? For the TypeError in argument_spec, is it because I use a more classic way to define the dictionaries ? |
If possible let's use less new Python things to keep this collection compatible with more systems in the world. |
I modified the code for the firsts 6 points. But for the 7: In the choises for |
Nope, it's more YAML thing, than Ansible. Let's set there something like |
Ok, |
@CyberFox001 please include this code in your patch, so that we can see your tests in CI jobs: #501 |
1 code modification done, but one question about the Python targeted version. Which command can I run on my desktop to run the same checks than those made in the pull request ? |
If you mean collection sanity tests, they are here: In general you install the changed collection from source to some specific directory, cd to this directory to
where "${{ matrix.python-version }}" is your python version. Ansible version is better take 2.9 and latest (because 2.9 is very specific). |
@CyberFox001 I think we can close this issue then? |
@sshnaidm Good question. The issue was with the But we can use the new I don't know what is the best choice: Close this issue when the What do you think ? |
@CyberFox001 I am having the same issue with the
The only way I could get it to work is if i put |
The fact that generating the systemd service for a pod also generates the systemd service for the containers is also problematic. |
Is this a BUG REPORT or FEATURE REQUEST?
/kind bug
Description
If I generate a systemd .service file for a pod, when I create the pod
before the containers creation, then systemd fail to start the
service.
I got this message:
I think it's because the .service file is generated before the add of
containers to the pod. So it miss the services of the containers in
its dependencies.
If I generate the systemd .service file for this pod after the creation of the containers, in a separate task like this:
The result is the deletion of the all the containers inside the pod, except for the infra container.
In generale, the documentation about the systemd integration with pod or containers is unclear:
Steps to reproduce the issue:
Describe the results you received:
A fail at the task that start the systemd service for the pod, with the message:
The command
systemctl --user status pod-peertube_instance.service
tell that the pod is working andjournalctl
have no infos.If I stop every containers and start only the pod, the containers of the pods are not started.
Describe the results you expected:
Entire pod should be managed with the systemd .service file, like when
I generate a .service file with the command
podman generate systemd
.And in generale, integration with systemd should be more simple and
with more informations in the documentation.
Additional information you deem important (e.g. issue happens only occasionally):
Version of the
containers.podman
collection:Either git commit if installed from git:
git show --summary
Or version from
ansible-galaxy
if installed from galaxy:ansible-galaxy collection list | grep containers.podman
Output of
ansible --version
:Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Playbok you run with ansible (e.g. content of
playbook.yaml
):See above
The text was updated successfully, but these errors were encountered: