mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
moved 'path exists' function to shell
now it will work with powershell/winrm
This commit is contained in:
parent
81d9066ee1
commit
28d20dbe53
4 changed files with 29 additions and 8 deletions
|
@ -94,6 +94,22 @@ class ShellModule(object):
|
|||
script = 'Write-Host "%s"' % self._escape(user_home_path)
|
||||
return self._encode_script(script)
|
||||
|
||||
def exists(self, path):
|
||||
path = self._escape(self._unquote(path))
|
||||
script = '''
|
||||
If (Test-Path "%s")
|
||||
{
|
||||
$res = 0;
|
||||
}
|
||||
Else
|
||||
{
|
||||
$res = 1;
|
||||
}
|
||||
Write-Host "$res";
|
||||
Exit $res;
|
||||
''' % path
|
||||
return self._encode_script(script)
|
||||
|
||||
def checksum(self, path, *args, **kwargs):
|
||||
path = self._escape(self._unquote(path))
|
||||
script = '''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue