Skip to content

Commit c8ed5f4

Browse files
committed
Fixed mistake with modules lacking name inside dict
Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
1 parent 856313c commit c8ed5f4

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

cfbs/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ def _perform_build_step(module, i, step, max_length):
290290
assert len(args) == 4
291291
print("%s replace '%s'" % (prefix, "' '".join(args)))
292292
# New build step so let's be a bit strict about validating it:
293-
validate_build_step(module, i, operation, args, strict=True)
293+
validate_build_step(name, module, i, operation, args, strict=True)
294294
n, a, b, file = args
295295
file = os.path.join(destination, file)
296296
_perform_replace_step(n, a, b, file)
297297
elif operation == "replace_version":
298298
assert len(args) == 3
299299
# New build step so let's be a bit strict about validating it:
300-
validate_build_step(module, i, operation, args, strict=True)
300+
validate_build_step(name, module, i, operation, args, strict=True)
301301
print("%s replace_version '%s'" % (prefix, "' '".join(args)))
302302
n = args[0]
303303
to_replace = args[1]

cfbs/validate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ def validate_config(config, empty_build_list_ok=False):
190190
return 1
191191

192192

193-
def validate_build_step(module, i, operation, args, strict=False):
194-
name = module["name"]
193+
def validate_build_step(name, module, i, operation, args, strict=False):
194+
assert type(name) is str
195+
assert type(module) is not str
196+
assert type(i) is int
195197
if not operation in AVAILABLE_BUILD_STEPS:
196198
raise CFBSValidationError(
197199
name,
@@ -408,7 +410,7 @@ def validate_steps(name, module):
408410
name, '"steps" must be a list of non-empty / non-whitespace strings'
409411
)
410412
operation, args = split_build_step(step)
411-
validate_build_step(module, i, operation, args)
413+
validate_build_step(name, module, i, operation, args)
412414

413415
def validate_url_field(name, module, field):
414416
assert field in module

0 commit comments

Comments
 (0)