Github user mxmrlv commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/207#discussion_r150817394
--- Diff: extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
---
@@ -640,24 +649,33 @@ def create_node_filter_constraints(context,
node_filter, target_node_template_co
for property_name, constraint_clause in properties:
constraint = create_constraint(context, node_filter,
constraint_clause,
property_name,
capability_name)
- target_node_template_constraints.append(constraint)
+ if constraint is not None:
+ target_node_template_constraints.append(constraint)
-def create_constraint(context, node_filter, constraint_clause,
property_name, capability_name): # pylint: disable=too-many-return-statements
+def create_constraint(context, node_filter, constraint_clause,
property_name, capability_name): # pylint:
disable=too-many-return-statements
+ if (not isinstance(constraint_clause._raw, dict)) or
(len(constraint_clause._raw) != 1):
+ context.validation.report(
+ u'node_filter constraint is not a dict with one key: {0}'
+ .format(safe_repr(constraint_clause._raw)),
+ locator=node_filter._locator,
+ level=Issue.FIELD)
+ return None
+
constraint_key = constraint_clause._raw.keys()[0]
the_type = constraint_clause._get_type(context)
- def coerce_constraint(constraint):
+ def coerce_constraint(constraint, the_type=the_type):
--- End diff --
consider renaming to `entity_type` or something similar.
---