Update jobspec parsing to contain vault_token at job level and not task level

This commit is contained in:
vishalnayak 2016-08-11 18:37:53 -04:00 committed by Alex Dadgar
parent ad088db6eb
commit fb7db1143c
8 changed files with 6 additions and 5 deletions

View File

@ -139,6 +139,7 @@ func parseJob(result *structs.Job, list *ast.ObjectList) error {
"meta",
"task",
"group",
"vault_token",
}
if err := checkHCLKeys(listVal, valid); err != nil {
return multierror.Prefix(err, "job:")
@ -1047,7 +1048,6 @@ func parseVault(result *structs.Vault, list *ast.ObjectList) error {
// Check for invalid keys
valid := []string{
"policies",
"token",
}
if err := checkHCLKeys(listVal, valid); err != nil {
return multierror.Prefix(err, "vault ->")

View File

@ -155,7 +155,6 @@ func TestParse(t *testing.T) {
},
Vault: &structs.Vault{
Policies: []string{"foo", "bar"},
Token: "baz",
},
},
&structs.Task{

View File

@ -4,6 +4,7 @@ job "binstore-storagelocker" {
priority = 50
all_at_once = true
datacenters = ["us2", "eu1"]
vault_token = "foo"
meta {
foo = "bar"

View File

@ -4,6 +4,7 @@ job "binstore-storagelocker" {
priority = 50
all_at_once = true
datacenters = ["us2", "eu1"]
vault_token = "foo"
meta {
foo = "bar"
@ -126,7 +127,6 @@ job "binstore-storagelocker" {
vault {
policies = ["foo", "bar"]
token = "baz"
}
}

View File

@ -4,6 +4,7 @@ job "binstore-storagelocker" {
priority = 50
all_at_once = true
datacenters = ["us2", "eu1"]
vault_token = "foo"
meta {
foo = "bar"

View File

@ -4,6 +4,7 @@ job "binstore-storagelocker" {
priority = 50
all_at_once = true
datacenters = ["us2", "eu1"]
vault_token = "foo"
meta {
foo = "bar"

View File

@ -17,11 +17,9 @@ job "binstore-storagelocker" {
vault {
policies = ["foo", "bar"]
token = "baz"
}
vault {
policies = ["1", "2"]
token = "3"
}
}
}

View File

@ -4,6 +4,7 @@ job "binstore-storagelocker" {
priority = 50
all_at_once = true
datacenters = ["us2", "eu1"]
vault_token = "foo"
meta {
foo = "bar"