-
Notifications
You must be signed in to change notification settings - Fork 26
Allow podman executable override with env #53
Conversation
Add possibility of setting podman executable through environment variable
Add podman_exec variable to enable using other podman executables, by setting environment variable MOLECULE_PODMAN_EXECUTABLE
Add podman_exec variable to enable using other podman executables, by setting environment variable MOLECULE_PODMAN_EXECUTABLE
LGTM, can you please add it to documentation? (Do we have documentation? 👀 ) Or at least to write an example of usage in comments. |
Update with short explanation on how to change podman executable
Make bold instead of subtitle
Add comment to explain how to change podman executable
Of course :) I have attempted to add some explanation, both as a comment oin the code and as a couple of lines in the README.rst :) |
Great, thanks! |
Divide comment into two lines
Divide comment into three lines
I am also using podman-remote on MacOS, but on that platform podman itself is podman-remote so no need to change anything. On the other hand podman itself has the Ideally podman should add Still, I do not support a feature that is not portable and Something like `if not-macos and CONTAINER_HOST in os.environ: add '--remote' to podman cli makes more sense to me. Before doing anything about this lets consult with podman cores, as they may give us some hints on the future plans, so we can avoid a hack that could easily break. |
No need depend on CONTAINER_HOST var, |
Change formatting of ansible_connection_options
add comma in ansible_connection_options
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 wait until we get feedback from podman team on containers/podman#11196 -- based on that we can decide which way to do.
To be clear I am extremely interested about ensuring podman remoting support works fine with our driver, is critical.
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.
I think this change may be valuable in some cases but I second Sorin's feedback — we way want to wait for the upstream to make a related decision first.
Meanwhile, I think that there's a workaround — add a custom podman
script to some directory that you manage in front of the $PATH
, and in that wrapper script, you could choose to run anything you like (for now).
@NikolineLykPedersen you can try to export Ansible environment variable as |
I think we do have a very good reason for creating a test for remote podman usage inside both the collection and this driver. That would help us avoid regressions in this area. Still, that would not be the subject of this PR. |
@sshnaidm Was On the other hand, I know that podman environment variables do start with |
|
Change from bold to title Co-authored-by: Sviatoslav Sydorenko <[email protected]>
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
Move definition of podman_exec out of the module-level + add step to find full path for podman_exec and give error, if it can't be found
I've tried with ANSIBLE_PODMAN_EXECUTABLE=podman-remote, but it doesn't affect how containers are created or logged into by molecule. But thanks for the suggestion :) I might look at the workaround suggested above. Thanks for all the feedback :) |
Add task to determine path to podman executable + use path to poodman executable in podman login and build commands
Also use path to executable in Create molecule instance + correct way path was stored as variable
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.
I still find this a hack that we may need to remove in the future but on the other hand a workaround today may prove more useful than a perfect solution in 2 years.
Head branch was pushed to by a user without write access
Add importstatements
@NikolineLykPedersen Check https://github.com/ansible-community/molecule-podman/invitations that should allow you to test changes without manual approval. |
@NikolineLykPedersen please fix the linting problems. If you do it quick we may include that in 1.0.0 release. You can use |
Fix linting errors
Remove trailing whitespaces
fix linting issues
Fix more linting issues
All the linting problems should be fixed now :) |
The idea behind this pull request is to add the posibility of changing the podman executable from the default, podman, to something else through an environment variable,
MOLECULE_PODMAN_EXECUTABLE
. This could for instance be podman-remote instead of podman. In that case the environment variable could be exported as:$ export MOLECULE_PODMAN_EXECUTABLE=podman-remote
The variable has been named
MOLECULE_PODMAN_EXECUTABLE
to match the similar variable in ansible, namelyANSIBLE_PODMAN_EXECUTABLE
Changes have been made both in
driver.py
,create.yml
, anddestroy.yml
, and have been tested withMOLECULE_PODMAN_EXECUTABLE=podman-remote
We needed this functionality at my work, and I thought others might be able to use it as well :)