do not fail for scheduled revocation (#11619)

pull/11621/head
Sylvia Moss 4 years ago committed by GitHub
parent bdaa03be31
commit 5135d68b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -127,8 +127,9 @@ func (client *Client) GetIteration(ctx context.Context, bucketSlug string, opts
}
if resp.Payload.Iteration != nil {
if !time.Time(resp.Payload.Iteration.RevokeAt).IsZero() {
// If RevokeAt is not a zero date, it means this iteration is revoked and should not be used
revokeAt := time.Time(resp.Payload.Iteration.RevokeAt)
if !revokeAt.IsZero() && revokeAt.Before(time.Now().UTC()) {
// If RevokeAt is not a zero date and is before NOW, it means this iteration is revoked and should not be used
// to build new images.
return nil, fmt.Errorf("the iteration %s is revoked and can not be used on Packer builds",
resp.Payload.Iteration.ID)
@ -254,8 +255,9 @@ func (client *Client) GetIterationFromChannel(
if resp.Payload.Channel != nil {
if resp.Payload.Channel.Iteration != nil {
if !time.Time(resp.Payload.Channel.Iteration.RevokeAt).IsZero() {
// If RevokeAt is not a zero date, it means this iteration is revoked and should not be used
revokeAt := time.Time(resp.Payload.Channel.Iteration.RevokeAt)
if !revokeAt.IsZero() && revokeAt.Before(time.Now().UTC()) {
// If RevokeAt is not a zero date and is before NOW, it means this iteration is revoked and should not be used
// to build new images.
return nil, fmt.Errorf("the iteration associated with the channel %s is revoked and can not be used on Packer builds",
channelName)

Loading…
Cancel
Save