Broken custom definitions and interfaces of relationships parents

Bug #1929616 reported by Валерия Валерьевна Швецова
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TOSCA Parser
New
Undecided
Unassigned

Bug Description

When using custom definitions there are problems if multiple derivations is used

Example:
tosca_definitions_version: tosca_simple_yaml_1_0

capability_types:
  openstack.capabilities.network.Linkable:
    derived_from: tosca.capabilities.Node
    properties:
      provider:
        type: string
        required: false

relationship_types:

  provider.relationships.DependsOn:
    description: This type results in ordering of initializing objects.
    derived_from: tosca.relationships.Root
    valid_target_types: [ tosca.capabilities.Node ]
    interfaces:
      Target:
        type: provider.interfaces.Target

  openstack.relationships.DependsOn:
    description: This type results in ordering of initializing objects.
    derived_from: provider.relationships.DependsOn
    valid_target_types: [ openstack.capabilities.Node ]

interface_types:
  provider.interfaces.Target:
    derived_from: tosca.interfaces.Root
    choose:
      description: Choose one object

node_types:
  openstack.nodes.FloatingIp:
    derived_from: tosca.nodes.Root
    properties:
      floating_ip_address:
        type: string
        required: false
    requirements:
      - network:
          capability: openstack.capabilities.network.Linkable
          relationship: tosca.relationships.network.LinksTo
          node: tosca.nodes.Network
          occurrences: [ 0, 1 ]

topology_template:
  node_templates:
    server_kube_master_floating_ip:
      type: openstack.nodes.FloatingIp
      properties:
        floating_ip_address: 10.100.115.15
      requirements:
        - network:
            node_filter:
              properties:
                - name:
                    get_operation_output:
                      - server_kube_master_server_name
                      - Target
                      - choose
                      - name

  relationship_templates:
    server_kube_master_server_name:
      type: openstack.relationships.DependsOn
      interfaces:
        Target:
          choose:
            implementation: choose_os_network_facts_ansible_facts_openstack_networks.yaml

If tosca-parser is used in code

    tosca_parser_template_object = ToscaTemplate(yaml_dict_tpl=template, a_file=a_file)
    print(tosca_parser_template_object.relationship_templates[0].interfaces)

error occurred

Traceback (most recent call last):
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/entity_template.py", line 119, in interfaces
    self._interfaces = self._create_interfaces()
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/entity_template.py", line 318, in _create_interfaces
    value=op_def)
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/elements/interfaces.py", line 51, in __init__
    if not self.interfacetype:
AttributeError: 'InterfacesDef' object has no attribute 'interfacetype'

The same happens when the following is used

    print(tosca_parser_template_object.relationship_templates[0].parent_type)

Error occurred

Error
Traceback (most recent call last):
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/entity_template.py", line 89, in parent_type
    return self.type_definition.parent_type
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/elements/relationshiptype.py", line 38, in parent_type
    return RelationshipType(prel, self.custom_def)
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/elements/relationshiptype.py", line 28, in __init__
    custom_def)
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/elements/statefulentitytype.py", line 51, in __init__
    InvalidTypeError(what=entitytype))
  File "/home/user/virt-env/tosca/lib/python3.6/site-packages/toscaparser/common/exception.py", line 206, in appendException
    raise exception
toscaparser.common.exception.InvalidTypeError: Type "provider.relationships.DependsOn" is not a valid type.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tosca-parser 2.4.1

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

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.