Clean up and fix logic in entity template constructor

Bug #1544805 reported by Sahdev Zala
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TOSCA Parser
Sahdev Zala

Bug Description

So lately, two new if conditions were added in the init,

        if entity_name == 'policy_type':
            type = self.entity_tpl.get('type')
            if not type:
                msg = (_('Policy definition of "%(pname)s" must have'
                       ' a "type" ''attribute.') % dict(pname=name))

            self.type_definition = PolicyType(type, custom_def)
        if entity_name == 'group_type':
            type = self.entity_tpl.get('type')
            self.type_definition = GroupType(type, custom_def) \
                if type is not None else None

there are many if for .get('type') so that should be refactored. Also validation error for type should be common. Also, it doesn't seem like we really need policy and group here, the node_type should be the on with group and policy type (thinking group and policy as node) but due to lack of concrete use cases, it wasn't tested properly.. need a second look.

Sahdev Zala (spzala)
Changed in tosca-parser:
assignee: nobody → Sahdev Zala (spzala)
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.