Show order of operations with parenthesis

This commit is contained in:
Michael Perzel 2015-09-08 11:20:35 -05:00 committed by Matt Clay
parent 0d78c01d32
commit f1e8de2f67

View file

@ -94,7 +94,7 @@ try {
if ($measure.count -eq 1 ) {
$exists = $true
}
elseif ($measure.count -eq 0 -and $state -eq "absent" ){
elseif ( ($measure.count -eq 0) -and ($state -eq "absent") ){
Set-Attr $result "msg" "Task does not exist"
Exit-Json $result
}
@ -120,13 +120,13 @@ try {
}
}
if ($state -eq "absent" -and $exists -eq $true) {
if ( ($state -eq "absent") -and ($exists -eq $true) ) {
Unregister-ScheduledTask -TaskName $name -Confirm:$false
$result.changed = $true
Set-Attr $result "msg" "Deleted task $name"
Exit-Json $result
}
elseif ($state -eq "absent" -and $exists -eq $false) {
elseif ( ($state -eq "absent") -and ($exists -eq $false) ) {
Set-Attr $result "msg" "Task $name does not exist"
Exit-Json $result
}
@ -138,14 +138,14 @@ try {
$settings = New-ScheduledTaskSettingsSet
}
if ($state -eq "present" -and $exists -eq $false){
if ( ($state -eq "present") -and ($exists -eq $false) ){
$action = New-ScheduledTaskAction -Execute $execute
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $name -Description $description -TaskPath $path -Settings $settings
$task = Get-ScheduledTask -TaskName $name
Set-Attr $result "msg" "Added new task $name"
$result.changed = $true
}
elseif($state -eq "present" -and $exists -eq $true) {
elseif( ($state -eq "present") -and ($exists -eq $true) ) {
if ($task.Description -eq $description -and $task.TaskName -eq $name -and $task.TaskPath -eq $path -and $task.Actions.Execute -eq $execute -and $taskState -eq $enabled) {
#No change in the task yet
Set-Attr $result "msg" "No change in task $name"