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

Modify volume mount behavior when source does not exist #1408

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from

Conversation

demonpig
Copy link

ansible-runner will ignore adding the mountpoint to the '-v` argument list if the source path does not exist. Instead it should respect whatever the user is passing to the '--container-volume-mount' option. The exception would be if the user tried to pass a file as the source path; ansible-runner should resolve the file's parent directory.

ansible-runner will ignore adding the mountpoint to the '-v` argument list if
the source path does not exist. Instead it should respect whatever the
user is passing to the '--container-volume-mount' option. The exception would
be if the user tried to pass a file as the source path; ansible-runner should
resolve the file's parent directory.
@demonpig demonpig requested a review from a team as a code owner January 10, 2025 19:43
@demonpig
Copy link
Author

I'm not entirely sure what to do about the failing unit tests. Please advise.

@Shrews
Copy link
Contributor

Shrews commented Jan 13, 2025

I had to research this behavior a bit, but it appears that docker and podman handle these cases differently, which is curious to me since I thought they tried to mostly be 1-to-1 compatible.

  • The docker run help page indicates that when the source volume mount does not exist, it will be created for you.
  • On the other hand, the podman run help page indicates that podman will throw an error when the source volume does not exist and users "must pre-create the source files or directories".

Given the differing behavior, I'm not in favor of this change as it is since it would suddenly cause users who may be using podman to get unexpected errors during a different/later phase of ansible-runner. If you were to modify the change to consider which container engine is in use (i.e., ignore the existence check if using docker), I'd be more in favor of it. This also might clear up some of the unit test failures, but likely not all of them.

@Shrews Shrews changed the title Fix AAP-37599 Modify volume mount behavior when source does not exist Jan 13, 2025
@Shrews
Copy link
Contributor

Shrews commented Jan 13, 2025

@demonpig After some discussion with others around this, I'm starting to come around to the idea of just keeping this as-is and letting the container engine do whatever it's going to do. I haven't had a chance to explore your unit test failures, but you should check how your changes affect the output that is expected when comparing the generated run command.

@demonpig
Copy link
Author

@Shrews Thanks for the updates. I'll take a look at them and see what I can do to fix them.

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