jobspec: fixup vault_grace deprecation

Followup to #7170

- Moved canonicalization of VaultGrace back into `api/` package.
- Fixed tests.
- Made docs styling consistent.
This commit is contained in:
Michael Schurter
2020-03-10 14:55:16 -07:00
parent 64c40af018
commit d145b395e8
8 changed files with 58 additions and 17 deletions

View File

@@ -531,6 +531,7 @@ func TestJobs_Canonicalize(t *testing.T) {
LeftDelim: stringToPtr("{{"),
RightDelim: stringToPtr("}}"),
Envvars: boolToPtr(false),
VaultGrace: timeToPtr(0),
},
{
SourcePath: stringToPtr(""),
@@ -543,6 +544,7 @@ func TestJobs_Canonicalize(t *testing.T) {
LeftDelim: stringToPtr("{{"),
RightDelim: stringToPtr("}}"),
Envvars: boolToPtr(true),
VaultGrace: timeToPtr(0),
},
},
},

View File

@@ -750,6 +750,11 @@ func (tmpl *Template) Canonicalize() {
if tmpl.Envvars == nil {
tmpl.Envvars = boolToPtr(false)
}
//COMPAT(0.12) VaultGrace is deprecated and unused as of Vault 0.5
if tmpl.VaultGrace == nil {
tmpl.VaultGrace = timeToPtr(0)
}
}
type Vault struct {