Error setting host relationship in "long" format

Bug #1779643 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

If you set the host requirement in long format (setting the capability type and/or the relatinship type) and the function get_property or get_attribute are used the parser fails:

node_types:

  tosca.nodes.SomeSoftwareComponent:
    derived_from: tosca.nodes.SoftwareComponent
    properties:
      test:
        type: string

topology_template:

  node_templates:

    some:
      type: tosca.nodes.SomeSoftwareComponent
      properties:
        test: { get_attribute: [ HOST, private_address ] }
      requirements:
      - host:
          node: server
          capability: tosca.capabilities.Container
          relationship: tosca.relationships.HostedOn

    server:
      type: tosca.nodes.Compute

This is the error:

  File "toscaparser/tosca_template.py", line 101, in __init__
    self.topology_template = self._topology_template()
  File "toscaparser/tosca_template.py", line 120, in _topology_template
    None)
  File "toscaparser/topology_template.py", line 63, in __init__
    self._process_intrinsic_functions()
  File "toscaparser/topology_template.py", line 252, in _process_intrinsic_functions
    prop.value)
  File "toscaparser/functions.py", line 856, in get_function
    return func(tosca_tpl, node_template, func_name, func_args)
  File "toscaparser/functions.py", line 54, in __init__
    self.validate()
  File "toscaparser/functions.py", line 146, in validate
    self._find_node_template_containing_attribute()
  File "toscaparser/functions.py", line 215, in _find_node_template_containing_attribute
    node_tpl = self._find_node_template(self.args[0])
  File "toscaparser/functions.py", line 258, in _find_node_template
    node_tpl = self._find_host_containing_attribute()
  File "toscaparser/functions.py", line 239, in _find_host_containing_attribute
    target_type = target_node.type_definition
AttributeError: 'NoneType' object has no attribute 'type_definition'

Changed in tosca-parser:
assignee: nobody → Miguel Caballer (micafer1)
status: New → In Progress
description: updated
Changed in tosca-parser:
status: In Progress → Fix Committed
Changed in tosca-parser:
status: Fix Committed → In Progress
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 1.3.0

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

Changed in tosca-parser:
status: Fix Committed → Fix Released
Revision history for this message
Sahdev Zala (spzala) wrote :

Nice. Thanks Miguel!

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.