Skip to content

Commit

Permalink
Allowed numbers in namespaces in module input.
Browse files Browse the repository at this point in the history
We wanted to make a `rhel_7_stig` namespace, which seems reasonable
so let's allow it.

I've seen other langauges not allowing identifiers to start with a number
to make things less ambiguous, so let's do that.

For example, `rhel_7_stig` is considered an acceptable namespace, while
`123`, `100_000`, and `1M` are not, since they look like values / numbers.

Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
  • Loading branch information
olehermanse committed Jan 24, 2024
1 parent 143d17b commit 5ab50f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cfbs/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ def validate_module_input(name, module):
'"%s" is not an acceptable variable name, must match regex "[a-z_]+"'
% input_element["variable"],
)
if not re.fullmatch(r"[a-z_]+", input_element["namespace"]):
if not re.fullmatch(r"[a-z_][a-z0-9_]+", input_element["namespace"]):
raise CFBSValidationError(
name,
'"%s" is not an acceptable namespace, must match regex "[a-z_]+"'
'"%s" is not an acceptable namespace, must match regex "[a-z_][a-z0-9_]+"'
% input_element["namespace"],
)
if not re.fullmatch(r"[a-z_]+", input_element["bundle"]):
Expand Down

0 comments on commit 5ab50f6

Please sign in to comment.