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", "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 ->")

View File

@ -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{

View File

@ -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"

View File

@ -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"
} }
} }

View File

@ -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"

View File

@ -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"

View File

@ -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"
} }
} }
} }

View File

@ -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"