@ -168,7 +168,7 @@ Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $fail
$value = $value | ConvertTo-Bool
}
$value
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
@ -193,13 +193,12 @@ Function ConvertTo-Bool
if ( ( $obj . GetType ( ) . Name -eq " Boolean " -and $obj ) -or $boolean_strings -contains $obj_string . ToLower ( ) )
{
$true
return $true
}
Else
{
$false
return $false
}
return
}
# Helper function to parse Ansible JSON arguments from a "file" passed as
@ -207,28 +206,27 @@ Function ConvertTo-Bool
# Example: $params = Parse-Args $args
Function Parse-Args($arguments , $supports_check_mode = $false )
{
$param eter s = New-Object psobject
$param s = New-Object psobject
If ( $arguments . Length -gt 0 )
{
$param eter s = Get-Content $arguments [ 0 ] | ConvertFrom-Json
$param s = Get-Content $arguments [ 0 ] | ConvertFrom-Json
}
$check_mode = Get-A ttr $parameters " _ansible_check_mode " $false | ConvertTo-Bool
$check_mode = Get-A nsibleParam -obj $params -name " _ansible_check_mode " -type " bool " -default $false
If ( $check_mode -and -not $supports_check_mode )
{
$obj = New-Object psobject
Set-Attr $obj " skipped " $true
Set-Attr $obj " changed " $false
Set-Attr $obj " msg " " remote module does not support check mode "
Exit-Json $obj
Exit-Json @ {
skipped = $true
changed = $false
msg = " remote module does not support check mode "
}
}
$param eter s
return $param s
}
# Helper function to calculate a hash of a file in a way which powershell 3
# and above can handle:
Function Get-FileChecksum($path )
{
$hash = " "
If ( Test-Path -PathType Leaf $path )
{
$sp = new-object -TypeName System . Security . Cryptography . SHA1CryptoServiceProvider ;
@ -238,7 +236,7 @@ Function Get-FileChecksum($path)
}
ElseIf ( Test-Path -PathType Container $path )
{
$hash = " 3 " ;
$hash = " 3 " ;
}
Else
{
@ -262,5 +260,4 @@ Function Get-PendingRebootStatus
{
return $False
}
}