Skip to content

Commit

Permalink
Update activation retry logic and logging (#236)
Browse files Browse the repository at this point in the history
* Update activation retry logic and logging

Clarifies when the script is giving up after max retry attempts; Better for parsing in the event of failure.

* Fix quotation for variable expansion

Needed after moving the variable up

* Move final error logic inside retry loop

Better logging and actually retries 3 times

* Update activate_instance.ps1
  • Loading branch information
jjerger authored Oct 2, 2023
1 parent c088ed5 commit 28e4813
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sysprep/activate_instance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ function Activate-Instance {
break
}
else {
Write-Output 'Activation failed.'
$retry_count = $retry_count - 1
}

if ($retry_count -gt 0) {
Write-Output "Retrying activation. Will try $retry_count more time(s)"
if ($retry_count -eq 0) {
Write-Output 'Activation failed. Max activation retry count reached: Giving up.'
}
else {
Write-Output "Activation failed. Will try $retry_count more time(s)."
}
}
}
}
Expand Down

0 comments on commit 28e4813

Please sign in to comment.