(action/script) Fix windows absolute path detection when executing powershell script (#50365)

This commit is contained in:
Steve Boyd 2019-01-06 15:44:54 -05:00 committed by Jordan Borean
parent 9093ca1f3b
commit 9693a55286

View file

@ -66,7 +66,7 @@ class ActionModule(ActionBase):
if chdir: if chdir:
# Powershell is the only Windows-path aware shell # Powershell is the only Windows-path aware shell
if self._connection._shell.SHELL_FAMILY == 'powershell' and \ if self._connection._shell.SHELL_FAMILY == 'powershell' and \
not self.windows_absolute_path_detection.matches(chdir): not self.windows_absolute_path_detection.match(chdir):
raise AnsibleActionFail('chdir %s must be an absolute path for a Windows remote node' % chdir) raise AnsibleActionFail('chdir %s must be an absolute path for a Windows remote node' % chdir)
# Every other shell is unix-path-aware. # Every other shell is unix-path-aware.
if self._connection._shell.SHELL_FAMILY != 'powershell' and not chdir.startswith('/'): if self._connection._shell.SHELL_FAMILY != 'powershell' and not chdir.startswith('/'):