Update docker connection plugin (#80)

* Update docker.py

#67832 fixes the need to run powershell modules on windows containers via docker connection. However, while running win_copy on windows containers, destination path is prefixed, which doesn't work in the case of windows. The changes in this PR take care of bypassing that while running the ansible role on windows containers.

* Update plugins/connection/docker.py

Co-Authored-By: Felix Fontein <felix@fontein.de>

* Create 80-update_docker_connection_plugin.yml

Add changelog fragment

* Update changelogs/fragments/80-update_docker_connection_plugin.yml

Co-Authored-By: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Ruheena Ansari 2020-03-31 14:42:16 -04:00 committed by Felix Fontein
parent 910f3adff2
commit c691264727

View File

@ -274,6 +274,10 @@ class Connection(ConnectionBase):
Can revisit using $HOME instead if it's a problem
'''
if getattr(self._shell, "_IS_WINDOWS", False):
import ntpath
return ntpath.normpath(remote_path)
else:
if not remote_path.startswith(os.path.sep):
remote_path = os.path.join(os.path.sep, remote_path)
return os.path.normpath(remote_path)
@ -328,6 +332,10 @@ class Connection(ConnectionBase):
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()
if getattr(self._shell, "_IS_WINDOWS", False):
import ntpath
actual_out_path = ntpath.join(out_dir, ntpath.basename(in_path))
else:
actual_out_path = os.path.join(out_dir, os.path.basename(in_path))
if p.returncode != 0: