Update jobspec parsing to contain vault_token at job level and not task level
This commit is contained in:
parent
ad088db6eb
commit
fb7db1143c
|
@ -139,6 +139,7 @@ func parseJob(result *structs.Job, list *ast.ObjectList) error {
|
||||||
"meta",
|
"meta",
|
||||||
"task",
|
"task",
|
||||||
"group",
|
"group",
|
||||||
|
"vault_token",
|
||||||
}
|
}
|
||||||
if err := checkHCLKeys(listVal, valid); err != nil {
|
if err := checkHCLKeys(listVal, valid); err != nil {
|
||||||
return multierror.Prefix(err, "job:")
|
return multierror.Prefix(err, "job:")
|
||||||
|
@ -1047,7 +1048,6 @@ func parseVault(result *structs.Vault, list *ast.ObjectList) error {
|
||||||
// Check for invalid keys
|
// Check for invalid keys
|
||||||
valid := []string{
|
valid := []string{
|
||||||
"policies",
|
"policies",
|
||||||
"token",
|
|
||||||
}
|
}
|
||||||
if err := checkHCLKeys(listVal, valid); err != nil {
|
if err := checkHCLKeys(listVal, valid); err != nil {
|
||||||
return multierror.Prefix(err, "vault ->")
|
return multierror.Prefix(err, "vault ->")
|
||||||
|
|
|
@ -155,7 +155,6 @@ func TestParse(t *testing.T) {
|
||||||
},
|
},
|
||||||
Vault: &structs.Vault{
|
Vault: &structs.Vault{
|
||||||
Policies: []string{"foo", "bar"},
|
Policies: []string{"foo", "bar"},
|
||||||
Token: "baz",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&structs.Task{
|
&structs.Task{
|
||||||
|
|
|
@ -4,6 +4,7 @@ job "binstore-storagelocker" {
|
||||||
priority = 50
|
priority = 50
|
||||||
all_at_once = true
|
all_at_once = true
|
||||||
datacenters = ["us2", "eu1"]
|
datacenters = ["us2", "eu1"]
|
||||||
|
vault_token = "foo"
|
||||||
|
|
||||||
meta {
|
meta {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
|
@ -4,6 +4,7 @@ job "binstore-storagelocker" {
|
||||||
priority = 50
|
priority = 50
|
||||||
all_at_once = true
|
all_at_once = true
|
||||||
datacenters = ["us2", "eu1"]
|
datacenters = ["us2", "eu1"]
|
||||||
|
vault_token = "foo"
|
||||||
|
|
||||||
meta {
|
meta {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
@ -126,7 +127,6 @@ job "binstore-storagelocker" {
|
||||||
|
|
||||||
vault {
|
vault {
|
||||||
policies = ["foo", "bar"]
|
policies = ["foo", "bar"]
|
||||||
token = "baz"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ job "binstore-storagelocker" {
|
||||||
priority = 50
|
priority = 50
|
||||||
all_at_once = true
|
all_at_once = true
|
||||||
datacenters = ["us2", "eu1"]
|
datacenters = ["us2", "eu1"]
|
||||||
|
vault_token = "foo"
|
||||||
|
|
||||||
meta {
|
meta {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
|
@ -4,6 +4,7 @@ job "binstore-storagelocker" {
|
||||||
priority = 50
|
priority = 50
|
||||||
all_at_once = true
|
all_at_once = true
|
||||||
datacenters = ["us2", "eu1"]
|
datacenters = ["us2", "eu1"]
|
||||||
|
vault_token = "foo"
|
||||||
|
|
||||||
meta {
|
meta {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
|
@ -17,11 +17,9 @@ job "binstore-storagelocker" {
|
||||||
|
|
||||||
vault {
|
vault {
|
||||||
policies = ["foo", "bar"]
|
policies = ["foo", "bar"]
|
||||||
token = "baz"
|
|
||||||
}
|
}
|
||||||
vault {
|
vault {
|
||||||
policies = ["1", "2"]
|
policies = ["1", "2"]
|
||||||
token = "3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ job "binstore-storagelocker" {
|
||||||
priority = 50
|
priority = 50
|
||||||
all_at_once = true
|
all_at_once = true
|
||||||
datacenters = ["us2", "eu1"]
|
datacenters = ["us2", "eu1"]
|
||||||
|
vault_token = "foo"
|
||||||
|
|
||||||
meta {
|
meta {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
Loading…
Reference in New Issue