Github user tliron commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/95#discussion_r109952085
--- Diff: aria/modeling/service_instance.py ---
@@ -529,6 +524,32 @@ def validate_capabilities(self):
satisfied = False
return satisfied
+ def find_host(self):
+ def _find_host(node):
+ if node.type.role == 'host':
+ return node
+ for the_relationship in node.outbound_relationships:
+ if (the_relationship.target_capability is not None) and \
+ the_relationship.target_capability.type.role == 'host':
+ host = _find_host(the_relationship.target_node)
+ if host is not None:
+ return host
+ for the_relationship in node.inbound_relationships:
+ if (the_relationship.target_capability is not None) and \
--- End diff --
This is a bit hard to explain. We tend to think of the host relationship as
"contained in", but TOSCA also allows for "hosts a" kind of relationship, for
example for features. See
[here](https://github.com/apache/incubator-ariatosca/blob/ARIA-92-plugin-in-implementation-string/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml#L177):
to find out the loadbalancer node's host, we need to look inbound that it is a
feature of Nginx.
So, bottom line is that this function has to be bi-recursive, both inbound
and outbound. Yay. :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---