Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/143#discussion_r120005524
  
    --- Diff: aria/modeling/service_template.py ---
    @@ -613,6 +597,56 @@ def dump(self):
                 utils.dump_dict_values(self.capability_templates, 'Capability 
templates')
                 utils.dump_list_values(self.requirement_templates, 
'Requirement templates')
     
    +    @property
    +    def next_index(self):
    +        """
    +        Next available node index.
    +
    +        :returns: node index
    +        :rtype: int
    +        """
    +
    +        max_index = 0
    +        if self.nodes:
    +            max_index = max(int(n.name.rsplit('_', 1)[-1]) for n in 
self.nodes)
    +        return max_index + 1
    +
    +    @property
    +    def next_name(self):
    +        """
    +        Next available node name.
    +
    +        :returns: node name
    +        :rtype: basestring
    +        """
    +
    +        return '{name}_{index}'.format(name=self.name, 
index=self.next_index)
    +
    +    @property
    +    def default_instances(self):
    +        # TODO: currently finds the first matching policy; but we should 
emit a validation error
    +        # if more than one policy applies to the same node
    +        for policy_template in 
self.service_template.policy_templates.itervalues():
    +            if policy_template.type.role == 'scaling':
    +                if policy_template.is_for_node_template(self.name):
    +                    default_instances = 
policy_template.properties.get('default_instances')
    +                    if (default_instances is not None) \
    +                        and (default_instances.type_name == 'integer'):
    --- End diff --
    
    how can it not be 'integer'?


---
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.
---

Reply via email to