ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject incubator-ariatosca git commit: PR fixes [Forced Update!]
Date Mon, 10 Jul 2017 08:48:17 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-254-multiple-nodes-per-template c0537bf13 -> 1240b5a4f (forced update)


PR fixes


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/1240b5a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1240b5a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1240b5a4

Branch: refs/heads/ARIA-254-multiple-nodes-per-template
Commit: 1240b5a4fe51831bdbb341032b448d97045deddb
Parents: 9d99fed
Author: Tal Liron <tal.liron@gmail.com>
Authored: Wed Jul 5 16:01:40 2017 -0500
Committer: Tal Liron <tal.liron@gmail.com>
Committed: Mon Jul 10 11:48:08 2017 +0300

----------------------------------------------------------------------
 aria/modeling/service_template.py               | 64 ++++++++++----------
 .../simple_v1_0/modeling/capabilities.py        |  8 ++-
 2 files changed, 38 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1240b5a4/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py
index df2f1a0..22912e2 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -622,7 +622,7 @@ class NodeTemplateBase(TemplateModelMixin):
 
     def instantiate(self, container):
         from . import models
-        node = models.Node(name=self.next_name,
+        node = models.Node(name=self._next_name,
                            type=self.type,
                            description=deepcopy_with_locators(self.description),
                            state=models.Node.INITIAL,
@@ -674,31 +674,6 @@ class NodeTemplateBase(TemplateModelMixin):
             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 scaling(self):
         scaling = {}
 
@@ -736,12 +711,12 @@ class NodeTemplateBase(TemplateModelMixin):
 
         # Validate
         # pylint: disable=too-many-boolean-expressions
-        if (scaling['min_instances'] < 0) or \
-            (scaling['max_instances'] < 0) or \
-            (scaling['default_instances'] < 0) or \
-            (scaling['max_instances'] < scaling['min_instances']) or \
-            (scaling['default_instances'] < scaling['min_instances']) or \
-            (scaling['default_instances'] > scaling['max_instances']):
+        if ((scaling['min_instances'] < 0) or
+                (scaling['max_instances'] < 0) or
+                (scaling['default_instances'] < 0) or
+                (scaling['max_instances'] < scaling['min_instances']) or
+                (scaling['default_instances'] < scaling['min_instances']) or
+                (scaling['default_instances'] > scaling['max_instances'])):
             context = ConsumptionContext.get_thread_local()
             context.validation.report('invalid scaling parameters for node template "{0}":
'
                                       'min={1}, max={2}, default={3}'.format(
@@ -764,6 +739,31 @@ class NodeTemplateBase(TemplateModelMixin):
                     return False
         return True
 
+    @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)
+
 
 class GroupTemplateBase(TemplateModelMixin):
     """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1240b5a4/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py
index 760541a..5427c7e 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py
@@ -189,15 +189,19 @@ def merge_capability_definition(context, presentation, capability_definition,
 
 
 def merge_capability_definition_from_type(context, presentation, capability_definition):
+    """
+    Merge ``properties`` and ``valid_source_types`` from the node type's capability definition
+    over those taken from the parent node type.
+    """
     raw_properties = OrderedDict()
 
-    # Merge properties from type
+    # Merge properties from parent
     the_type = capability_definition._get_type(context)
     type_property_defintions = the_type._get_properties(context)
     merge_raw_parameter_definitions(context, presentation, raw_properties, type_property_defintions,
                                     'properties')
 
-    # Merge our properties
+    # Merge our properties (might override definitions in parent)
     merge_raw_parameter_definitions(context, presentation, raw_properties,
                                     capability_definition.properties, 'properties')
 


Mime
View raw message