feat: add locked TTL field to template meta (#8020)

This commit is contained in:
Jon Ayers
2023-06-19 22:37:55 -04:00
committed by GitHub
parent 1ecc371ade
commit c3aef9363b
27 changed files with 291 additions and 90 deletions

View File

@ -327,6 +327,7 @@ func (*enterpriseTemplateScheduleStore) GetTemplateScheduleOptions(ctx context.C
MaxTTL: time.Duration(tpl.MaxTTL),
FailureTTL: time.Duration(tpl.FailureTTL),
InactivityTTL: time.Duration(tpl.InactivityTTL),
LockedTTL: time.Duration(tpl.LockedTTL),
}, nil
}
@ -335,6 +336,7 @@ func (*enterpriseTemplateScheduleStore) SetTemplateScheduleOptions(ctx context.C
int64(opts.MaxTTL) == tpl.MaxTTL &&
int64(opts.FailureTTL) == tpl.FailureTTL &&
int64(opts.InactivityTTL) == tpl.InactivityTTL &&
int64(opts.LockedTTL) == tpl.LockedTTL &&
opts.UserAutostartEnabled == tpl.AllowUserAutostart &&
opts.UserAutostopEnabled == tpl.AllowUserAutostop {
// Avoid updating the UpdatedAt timestamp if nothing will be changed.
@ -350,6 +352,7 @@ func (*enterpriseTemplateScheduleStore) SetTemplateScheduleOptions(ctx context.C
MaxTTL: int64(opts.MaxTTL),
FailureTTL: int64(opts.FailureTTL),
InactivityTTL: int64(opts.InactivityTTL),
LockedTTL: int64(opts.LockedTTL),
})
if err != nil {
return database.Template{}, xerrors.Errorf("update template schedule: %w", err)