mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Add integration tests for fetch/slurp, make powershell fetch/slurp work as close as possible to existing fetch/slurp modules.
This commit is contained in:
parent
ef968efa8b
commit
243cd877ae
13 changed files with 403 additions and 44 deletions
|
@ -85,7 +85,21 @@ class ShellModule(object):
|
|||
|
||||
def md5(self, path):
|
||||
path = _escape(path)
|
||||
return _encode_script('''(Get-FileHash -Path "%s" -Algorithm MD5).Hash.ToLower();''' % path)
|
||||
script = '''
|
||||
If (Test-Path -PathType Leaf "%(path)s")
|
||||
{
|
||||
(Get-FileHash -Path "%(path)s" -Algorithm MD5).Hash.ToLower();
|
||||
}
|
||||
ElseIf (Test-Path -PathType Container "%(path)s")
|
||||
{
|
||||
Write-Host "3";
|
||||
}
|
||||
Else
|
||||
{
|
||||
Write-Host "1";
|
||||
}
|
||||
''' % dict(path=path)
|
||||
return _encode_script(script)
|
||||
|
||||
def build_module_command(self, env_string, shebang, cmd, rm_tmp=None):
|
||||
cmd_parts = shlex.split(cmd, posix=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue