mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Quote any file paths that we have to use with dd to copy.
This is because we pass the whole dd command string into the shell that's running on the contained environment rather than running it directly from python via subprocess without a shell.
This commit is contained in:
@@ -22,6 +22,7 @@ __metaclass__ = type
|
||||
import distutils.spawn
|
||||
import os
|
||||
import os.path
|
||||
import pipes
|
||||
import subprocess
|
||||
import traceback
|
||||
|
||||
@@ -117,7 +118,7 @@ class Connection(ConnectionBase):
|
||||
super(Connection, self).put_file(in_path, out_path)
|
||||
self._display.vvv("PUT %s TO %s" % (in_path, out_path), host=self.chroot)
|
||||
|
||||
out_path = self._prefix_login_path(out_path)
|
||||
out_path = pipes.quote(self._prefix_login_path(out_path))
|
||||
try:
|
||||
with open(in_path, 'rb') as in_file:
|
||||
try:
|
||||
@@ -139,7 +140,7 @@ class Connection(ConnectionBase):
|
||||
super(Connection, self).fetch_file(in_path, out_path)
|
||||
self._display.vvv("FETCH %s TO %s" % (in_path, out_path), host=self.chroot)
|
||||
|
||||
in_path = self._prefix_login_path(in_path)
|
||||
in_path = pipes.quote(self._prefix_login_path(in_path))
|
||||
try:
|
||||
p = self._buffered_exec_command('dd if=%s bs=%s' % (in_path, BUFSIZE))
|
||||
except OSError:
|
||||
|
||||
Reference in New Issue
Block a user