change tools mandatory attributes to set type and iterate only on those attributes

This commit is contained in:
Thomas Fricard 2022-08-16 14:15:08 +02:00
parent 9c7bcb84aa
commit f5d7634e00

View file

@ -75,13 +75,12 @@ No shelf definition found for shelf set named '{}'".format(shelf_set_name)
shelf named {}".format(shelf_name))
return
mandatory_attributes = ['name', 'script']
mandatory_attributes = {'name', 'script'}
for tool_definition in shelf_definition.get('tools_list'):
# We verify that the name and script attibutes of the tool
# are set
if not all(
[v for k, v in tool_definition.items() if
k in mandatory_attributes]
tool_definition[key] for key in mandatory_attributes
):
log.warning("TOOLS ERROR: You need to specify at least \
the name and the script path of the tool.")