Uppercase characters in function names lead to execution failure
In a new Nom Nom App, create an action function with an upper case character in its name. For example:
@engine.action(
display_name="Delete by Tag",
description="",
)
@engine.parameter_group(
name="source_parameters",
display_name="Source Parameters",
description="",
parameter_group=ParameterGroup(
Parameter(
type=String(),
name="tag",
display_name="Tag",
description="",
required=False,
),
)
)
def delete_snapshopt_by_Tag(parameters):
return ""
dump-yaml will work properly with the app creating an entry like this:
delete_snapshopt_by_Tag:
display_name: Delete by Tag
description:
parameters:
- name: source_parameters
display_name: Source Parameters
description: ''
type: group
collapsed: false
parameters:
- name: tag
display_name: Tag
description:
required: false
type: string
shared_object_type_uuid: STRING-SHAREDOBJECT
And model-update and deploy will both execute without error. However, create and new task and run it. You will see the following passed to the execution:
{
"action_name": "delete_snapshopt_by_tag",
"alias": "Test",
"tag": "x",
}
Because the value for "action_name" has been converted to lowercase, the parameters associated with it are not found as the parameters to pass to the function with the uppercase letter in its name. Resulting in an empty dictionary being passed for parameters, causing the execution to generate this error:
File \"main.py\", line 4, in <module>
engine.main()
File \"/usr/local/lib/python3.7/site-packages/nomnomdata/engine/engine.py\", line 225, in main
_cli.main()
File \"/usr/local/lib/python3.7/site-packages/click/core.py\", line 782, in main
rv = self.invoke(ctx)
File \"/usr/local/lib/python3.7/site-packages/click/core.py\", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File \"/usr/local/lib/python3.7/site-packages/click/core.py\", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File \"/usr/local/lib/python3.7/site-packages/click/core.py\", line 610, in invoke
return callback(*args, **kwargs)
File \"/usr/local/lib/python3.7/site-packages/nomnomdata/engine/engine.py\", line 34, in run
current_engine._run()
File \"/usr/local/lib/python3.7/site-packages/nomnomdata/engine/engine.py\", line 171, in _run
kwargs = self._finalize_kwargs(action.all_parameters, params)
AttributeError: 'dict' object has no attribute 'all_parameters'
Edited by Josh Sherman