Skip to content

Commit

Permalink
[stable-2.9] podman - fix rootless container copy no pause (ansible#6…
Browse files Browse the repository at this point in the history
…6583)

Fixes ansible#66263

Signed-off-by: Adam Miller <admiller@redhat.com>
(cherry picked from commit 077a8b4)

Co-authored-by: Adam Miller <admiller@redhat.com>
  • Loading branch information
maxamillion authored and samdoran committed Jan 17, 2020
1 parent 85f36a3 commit cca4b83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
@@ -0,0 +1,2 @@
bugfixes:
- podman connection plugin - fix to handle the new default copy pause rootless containers from upstream (https://github.com/ansible/ansible/issues/66263)
14 changes: 11 additions & 3 deletions lib/ansible/plugins/connection/podman.py
Expand Up @@ -133,10 +133,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 'cannot copy into running rootless container with pause set' in to_native(stderr):
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

0 comments on commit cca4b83

Please sign in to comment.