hashicorp/nomad-pack

Parsing 'Region' and 'Namespace' fails when containing non-word characters

johanforssell opened this issue · 1 comments

namespaceRe := regexp.MustCompile(`(?m)namespace = \"(\w+)`)
regionRe := regexp.MustCompile(`(?m)region = \"(\w+)`)

\w+ is used to parse the region and the namespace. This is inadequate when they contain non-word characters.

"-" is a common non-word character which even shows up in the official documentation of Namespaces.

$ export NOMAD_NAMESPACE=web-qa

I've been looking in the Nomad code but cannot find any validation rules for the name of a namespace.

On another note, the error message for failing to run/plan a job could use some improvements. I had to pull down the source code and do my own debugging to understand that my namespace was truncated on submit.

This regex thing is very broken by design, see #422 (comment)