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 Tue, 09 May 2017 08:09:19 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-165-Make-node-name-suffix-UUIDs-become-more-readable 69531fd24 -> 7aecdcfa8
(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/7aecdcfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/7aecdcfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/7aecdcfa

Branch: refs/heads/ARIA-165-Make-node-name-suffix-UUIDs-become-more-readable
Commit: 7aecdcfa8f9319ebfc83e88755072f135334b6e7
Parents: b11fbc9
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 11:09:13 2017 +0300

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


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7aecdcfa/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py
index 7fab4fc..3340a92 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -549,9 +549,14 @@ 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)
+        import pydevd; pydevd.settrace('localhost', suspend=False)
+        if self.nodes:
+            highest_name_suffix = max(self.nodes, key=lambda n: n.name).name.rsplit('_',
1)[1]
+            suffix = int(highest_name_suffix) + 1
+        else:
+            suffix = 1
+        name = '{name}_{index}'.format(name=self.name, index=suffix)
         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/7aecdcfa/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