Add integration tests for fetch/slurp, make powershell fetch/slurp work as close as possible to existing fetch/slurp modules.

reviewable/pr18780/r1
Chris Church 11 years ago committed by Matt Martz
parent 9a52ee4753
commit e9c9cab3c8

@ -33,15 +33,32 @@ Else
}
If (-not $src)
{
$result = New-Object psobject @{};
Fail-Json $result "missing required argument: src";
}
$bytes = [System.IO.File]::ReadAllBytes($src);
$content = [System.Convert]::ToBase64String($bytes);
If (Test-Path $src)
{
If ((Get-Item $src).Directory) # Only files have the .Directory attribute.
{
$bytes = [System.IO.File]::ReadAllBytes($src);
$content = [System.Convert]::ToBase64String($bytes);
$result = New-Object psobject @{
$result = New-Object psobject @{
changed = $false
encoding = "base64"
};
Set-Attr $result "content" $content;
Exit-Json $result;
};
Set-Attr $result "content" $content;
Exit-Json $result;
}
Else
{
$result = New-Object psobject @{};
Fail-Json $result ("is a directory: " + $src);
}
}
Else
{
$result = New-Object psobject @{};
Fail-Json $result ("file not found: " + $src);
}

Loading…
Cancel
Save