diff --git a/plugins/connection/podman.py b/plugins/connection/podman.py index 6cb96b5..1ea1f94 100644 --- a/plugins/connection/podman.py +++ b/plugins/connection/podman.py @@ -166,15 +166,14 @@ class Connection(ConnectionBase): "cp", [in_path, self._container_id + ":" + out_path], use_container_id=False ) if rc != 0: - 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 + 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) ) - 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(