mattjackson220 commented on a change in pull request #5544:
URL: https://github.com/apache/trafficcontrol/pull/5544#discussion_r578805338
##########
File path: traffic_ops/traffic_ops_golang/deliveryservice/autorenewcerts.go
##########
@@ -216,17 +267,35 @@ func RunAutorenewal(existingCerts []ExistingCerts, cfg
*config.Config, ctx conte
} else {
userErr, sysErr, statusCode :=
renewAcmeCerts(cfg, keyObj.DeliveryService, ctx, currentUser)
if userErr != nil {
+ errorCount++
dsExpInfo.Error = userErr
} else if sysErr != nil {
+ errorCount++
dsExpInfo.Error = sysErr
} else if statusCode != http.StatusOK {
+ errorCount++
dsExpInfo.Error = errors.New("Status
code not 200: " + strconv.Itoa(statusCode))
+ } else {
+ renewedCount++
}
keysFound.AcmeExpirations =
append(keysFound.AcmeExpirations, dsExpInfo)
}
}
+ if err = api.UpdateAsyncStatus(db, api.AsyncPending, "ACME
renewal in progress. "+strconv.Itoa(renewedCount)+" certs renewed,
"+strconv.Itoa(errorCount)+" errors.", asyncStatusId, false); err != nil {
+ log.Errorf("updating async status for id %v: %v",
asyncStatusId, err.Error())
+ }
+
+ }
+
+ // put status as succeeded if any certs were successfully renewed
+ asyncStatus := api.AsyncSucceeded
+ if errorCount > 0 && renewedCount == 0 {
+ asyncStatus = api.AsyncFailed
+ }
+ if err = api.UpdateAsyncStatus(db, asyncStatus, "ACME renewal complete.
"+strconv.Itoa(renewedCount)+" certs renewed, "+strconv.Itoa(errorCount)+"
errors.", asyncStatusId, true); err != nil {
+ log.Errorf("updating async status for id %v: %v",
asyncStatusId, err.Error())
Review comment:
oh thats really good to know! thanks! just pushed to clean that up
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]