1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix #1101: win_webpicmd strict mode fixes

This commit is contained in:
Brian Geihsler 2015-10-14 00:39:59 -07:00 committed by Matt Clay
parent c60d6cad72
commit 30da816c54

View file

@ -42,9 +42,9 @@ Function Find-Command
) )
$installed = get-command $command -erroraction Ignore $installed = get-command $command -erroraction Ignore
write-verbose "$installed" write-verbose "$installed"
if ($installed.length -gt 0) if ($installed)
{ {
return $installed[0] return $installed
} }
return $null return $null
} }
@ -87,8 +87,12 @@ Function Test-IsInstalledFromWebPI
} }
Write-Verbose "$results" Write-Verbose "$results"
$matches = $results | select-string -pattern "^$package\s+" if ($results -match "^$package\s+")
return $matches.length -gt 0 {
return $true
}
return $false
} }
Function Install-WithWebPICmd Function Install-WithWebPICmd
@ -112,8 +116,8 @@ Function Install-WithWebPICmd
} }
write-verbose "$results" write-verbose "$results"
$success = $results | select-string -pattern "Install of Products: SUCCESS"
if ($success.length -gt 0) if ($results -match "Install of Products: SUCCESS")
{ {
$result.changed = $true $result.changed = $true
} }