Skip to content

Commit 61dbd7d

Browse files
authored
Error check added in OpCon_JobAction
1 parent 61cf739 commit 61dbd7d

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Module/OpConModule.psm1

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,18 +1090,23 @@ function OpCon_JobAction($url,$token,$sname,$jname,$jobId,$date,$action,$reason)
10901090
for($x = 0;$x -lt 20;$x++)
10911091
{
10921092
$jobaction
1093-
$result = OpCon_GetJobAction -url $url -token $token -id $jobaction.id
1094-
1095-
if($result.result -eq "success")
1096-
{ $x = 20 }
1097-
elseif($result.result -eq "error")
1093+
if($jobaction.id)
10981094
{
1099-
Write-Host "Job action attempt had an error"
1100-
$result
1095+
$result = OpCon_GetJobAction -url $url -token $token -id $jobaction.id
1096+
1097+
if($result.result -eq "success")
1098+
{ $x = 20 }
1099+
elseif($result.result -eq "error")
1100+
{
1101+
Write-Host "Job action attempt had an error"
1102+
$result
1103+
}
1104+
1105+
if($x -ne 20)
1106+
{ Start-Sleep -s 3 }
11011107
}
1102-
1103-
if($x -ne 20)
1104-
{ Start-Sleep -s 3 }
1108+
else
1109+
{ Break }
11051110
}
11061111
return $result
11071112
}

0 commit comments

Comments
 (0)