ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: ARIA-165 Make node name suffix UUIDs become more readable [Forced Update!]
Date Mon, 08 May 2017 22:02:17 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-165-Make-node-name-suffix-UUIDs-become-more-readable cfe8e546c -> 4c3050e00
(forced update)


ARIA-165 Make node name suffix UUIDs become more readable


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

Branch: refs/heads/ARIA-165-Make-node-name-suffix-UUIDs-become-more-readable
Commit: 4c3050e00556df82a2798d5f8bf91a4a0d949d32
Parents: 0ec2370
Author: max-orlov <maxim@gigaspaces.com>
Authored: Mon May 8 15:25:37 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Tue May 9 01:02:11 2017 +0300

----------------------------------------------------------------------
 aria/modeling/service_template.py | 8 ++++++--
 aria/parser/modeling/context.py   | 5 -----
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c3050e0/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py
index 7fab4fc..0050f4a 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -549,9 +549,13 @@ class NodeTemplateBase(TemplateModelMixin):
             ('requirement_templates', formatting.as_raw_list(self.requirement_templates))))
 
     def instantiate(self, container):
-        context = ConsumptionContext.get_thread_local()
         from . import models
-        name = context.modeling.generate_node_id(self.name)
+        if self.nodes:
+            latest_node_index = self.nodes[-1].name.rsplit('_', 1)[1]
+            index = int(latest_node_index) + 1
+        else:
+            index = 0
+        name = '{name}_{index}'.format(name=self.name, index=index)
         node = models.Node(name=name,
                            type=self.type,
                            description=deepcopy_with_locators(self.description),

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c3050e0/aria/parser/modeling/context.py
----------------------------------------------------------------------
diff --git a/aria/parser/modeling/context.py b/aria/parser/modeling/context.py
index dff5991..4a53641 100644
--- a/aria/parser/modeling/context.py
+++ b/aria/parser/modeling/context.py
@@ -67,11 +67,6 @@ class ModelingContext(object):
         if self.instance is not None:
             model_storage.service.put(self.instance)
 
-    def generate_node_id(self, template_name):
-        return self.node_id_format.format(
-            template=template_name,
-            id=self.generate_id())
-
     def generate_id(self):
         if self.id_type == IdType.LOCAL_SERIAL:
             return self._serial_id_counter.next()


Mime
View raw message