Skip to content

Commit

Permalink
Improved some validation warning messages
Browse files Browse the repository at this point in the history
Code review suggestions from @craigcomstock

Co-authored-by: Craig Comstock <craig.comstock@northern.tech>
Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
  • Loading branch information
olehermanse and craigcomstock committed Dec 12, 2023
1 parent ba459ce commit edd4a7b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cfbs/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ def validate_steps(name, module):
if not operation in AVAILABLE_BUILD_STEPS:
x = ", ".join(AVAILABLE_BUILD_STEPS)
raise CFBSValidationError(
name, 'Unknown operation in "steps", must be one of: (%s)' % x
name,
'Unknown operation "%s" in "steps", must be one of: (%s)'
% (operation, x),
)
expected = AVAILABLE_BUILD_STEPS[operation]
actual = len(args)
Expand Down Expand Up @@ -341,18 +343,20 @@ def validate_module_input(name, module):
if not re.fullmatch(r"[a-z_]+", input_element["variable"]):
raise CFBSValidationError(
name,
'"%s" is not an acceptable variable name'
'"%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"]):
raise CFBSValidationError(
name,
'"%s" is not an acceptable namespace' % input_element["namespace"],
'"%s" is not an acceptable namespace, must match regex "[a-z_]+"'
% input_element["namespace"],
)
if not re.fullmatch(r"[a-z_]+", input_element["bundle"]):
raise CFBSValidationError(
name,
'"%s" is not an acceptable bundle name' % input_element["bundle"],
'"%s" is not an acceptable bundle name, must match regex "[a-z_]+"'
% input_element["bundle"],
)

if input_element["type"] == "list":
Expand Down

0 comments on commit edd4a7b

Please sign in to comment.