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

podman - fix rootless container copy no pause #66583

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,2 @@
bugfixes:
- podman connection plugin - fix to handle the new default copy pause rootless containers from upstream
maxamillion marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 11 additions & 3 deletions lib/ansible/plugins/connection/podman.py
Expand Up @@ -163,10 +163,18 @@ def put_file(self, in_path, out_path):
display.vvv("PUT %s TO %s" % (in_path, out_path), host=self._container_id)
if not self._mount_point:
rc, stdout, stderr = self._podman(
"cp", [in_path, self._container_id + ":" + out_path], use_container_id=False)
"cp", [in_path, self._container_id + ":" + out_path], use_container_id=False
)
if rc != 0:
raise AnsibleError("Failed to copy file from %s to %s in container %s\n%s" % (
in_path, out_path, self._container_id, stderr))
if to_native('cannot copy into running rootless container with pause set' in to_native(stderr)):
maxamillion marked this conversation as resolved.
Show resolved Hide resolved
rc, stdout, stderr = self._podman(
"cp", ["--pause=false", in_path, self._container_id + ":" + out_path], use_container_id=False
)
if rc != 0:
raise AnsibleError(
"Failed to copy file from %s to %s in container %s\n%s" % (
in_path, out_path, self._container_id, stderr)
)
else:
real_out_path = self._mount_point + to_bytes(out_path, errors='surrogate_or_strict')
shutil.copyfile(
Expand Down