InvalidTypeError is raised when a custom def datatype attribute is requested in a function

Bug #1964972 reported by Miguel Caballer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TOSCA Parser
Fix Released
Undecided
Miguel Caballer

Bug Description

When a coustom defined datatype is used in a function and an attribute is requested in a the function an InvalidTypeError error is raised.

toscaparser.common.exception.ValidationError:
The pre-parsed input failed validation with the following error(s):

        InvalidTypeError: Type "tosca.datatypes.SomeDataType" is not a valid type.
...
                        self.tosca = ToscaTemplate(yaml_dict_tpl=copy.deepcopy(self.yaml))
                File /usr/local/lib/python3.8/dist-packages/toscaparser/tosca_template.py, line 103, in __init__
                        self.topology_template = self._topology_template()
                File /usr/local/lib/python3.8/dist-packages/toscaparser/tosca_template.py, line 118, in _topology_template
                        return TopologyTemplate(self._tpl_topology_template(),
                File /usr/local/lib/python3.8/dist-packages/toscaparser/topology_template.py, line 63, in __init__
                        self._process_intrinsic_functions()
                File /usr/local/lib/python3.8/dist-packages/toscaparser/topology_template.py, line 338, in _process_intrinsic_functions
                        func = functions.get_function(self, self.outputs, output.value)
                File /usr/local/lib/python3.8/dist-packages/toscaparser/functions.py, line 897, in get_function
                        return func(tosca_tpl, node_template, func_name, func_args)
                File /usr/local/lib/python3.8/dist-packages/toscaparser/functions.py, line 51, in __init__
                        self.validate()
                File /usr/local/lib/python3.8/dist-packages/toscaparser/functions.py, line 182, in validate
                        data_type = DataType(value_type)
                File /usr/local/lib/python3.8/dist-packages/toscaparser/elements/datatype.py, line 21, in __init__
                        super(DataType, self).__init__(datatypename,
                File /usr/local/lib/python3.8/dist-packages/toscaparser/elements/statefulentitytype.py, line 50, in __init__
                        ExceptionCollector.appendException(

        KeyError: 'Illegal arguments for function "get_attribute". Attribute name "tasks" not found in "tosca.datatypes.SomeDataType"'
 ...
                        self.tosca = ToscaTemplate(yaml_dict_tpl=copy.deepcopy(self.yaml))
                File /usr/local/lib/python3.8/dist-packages/toscaparser/tosca_template.py, line 103, in __init__
                        self.topology_template = self._topology_template()
                File /usr/local/lib/python3.8/dist-packages/toscaparser/tosca_template.py, line 118, in _topology_template
                        return TopologyTemplate(self._tpl_topology_template(),
                File /usr/local/lib/python3.8/dist-packages/toscaparser/topology_template.py, line 63, in __init__
                        self._process_intrinsic_functions()
                File /usr/local/lib/python3.8/dist-packages/toscaparser/topology_template.py, line 338, in _process_intrinsic_functions
                        func = functions.get_function(self, self.outputs, output.value)
                File /usr/local/lib/python3.8/dist-packages/toscaparser/functions.py, line 897, in get_function
                        return func(tosca_tpl, node_template, func_name, func_args)
                File /usr/local/lib/python3.8/dist-packages/toscaparser/functions.py, line 51, in __init__
                        self.validate()
                File /usr/local/lib/python3.8/dist-packages/toscaparser/functions.py, line 189, in validate
                        ExceptionCollector.appendException(

Changed in tosca-parser:
assignee: nobody → Miguel Caballer (micafer1)
Changed in tosca-parser:
status: New → In Progress
Revision history for this message
Sahdev Zala (spzala) wrote :

Thanks Miguel!!

Changed in tosca-parser:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tosca-parser 2.6.0

This issue was fixed in the openstack/tosca-parser 2.6.0 release.

Changed in tosca-parser:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.