Fix bug that could lead to validation to fail when attempting to update immutable field

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2020-05-01 12:18:34 +01:00
parent 3e8649abc2
commit 982b21bb06

View File

@ -239,9 +239,10 @@ func (c *controller) updateOrderStatus(ctx context.Context, cl acmecl.Interface,
}
o.Status.FinalizeURL = acmeOrder.FinalizeURL
c.setOrderState(&o.Status, acmeOrder.Status)
// only set the authorizations field if the lengths mismatch.
// state can be rebuilt in this case on the next call to ProcessItem.
if len(o.Status.Authorizations) != len(acmeOrder.AuthzURLs) {
// once the 'authorizations' slice contains at least one item, it cannot be
// updated. If it does not contain any items, update it containing the list
// of authorizations returned on the Order.
if len(o.Status.Authorizations) == 0 {
o.Status.Authorizations = constructAuthorizations(acmeOrder)
}