Docker cp sets file ownership to root:root so we can't use it.

Fixes #13219
This commit is contained in:
Toshio Kuratomi 2015-11-20 07:45:00 -08:00
parent d75e707af5
commit 591c81e95f

View file

@ -80,8 +80,10 @@ class Connection(ConnectionBase):
docker_version = self._get_docker_version() docker_version = self._get_docker_version()
if LooseVersion(docker_version) < LooseVersion('1.3'): if LooseVersion(docker_version) < LooseVersion('1.3'):
raise AnsibleError('docker connection type requires docker 1.3 or higher') raise AnsibleError('docker connection type requires docker 1.3 or higher')
if LooseVersion(docker_version) >= LooseVersion('1.8.0'): # Docker cp in 1.8.0 sets the owner and group to root rather than the
self.can_copy_bothways = True # user that the docker container is set to use by default.
#if LooseVersion(docker_version) >= LooseVersion('1.8.0'):
# self.can_copy_bothways = True
@staticmethod @staticmethod
def _sanitize_version(version): def _sanitize_version(version):
@ -93,7 +95,7 @@ class Connection(ConnectionBase):
cmd_output = subprocess.check_output(cmd) cmd_output = subprocess.check_output(cmd)
for line in cmd_output.split('\n'): for line in cmd_output.split('\n'):
if line.startswith('Server version:'): # old docker versions if line.startswith('Server version:'): # old docker versions
return self._sanitize_version(line.split()[2]) return self._sanitize_version(line.split()[2])
# no result yet, must be newer Docker version # no result yet, must be newer Docker version