From 4aba267bcced0b647a40bdee88ca55d351c6ffde Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 15 Sep 2015 17:38:23 -0700 Subject: [PATCH] nomad: ensure job ID does not contain space --- nomad/structs/structs.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index f54d0bee5..794a5083a 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -4,6 +4,7 @@ import ( "bytes" "errors" "fmt" + "strings" "time" "github.com/hashicorp/errwrap" @@ -745,6 +746,8 @@ func (j *Job) Validate() error { } if j.ID == "" { mErr.Errors = append(mErr.Errors, errors.New("Missing job ID")) + } else if strings.Contains(j.ID, " ") { + mErr.Errors = append(mErr.Errors, errors.New("Job ID contains a space")) } if j.Name == "" { mErr.Errors = append(mErr.Errors, errors.New("Missing job name"))