Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
ARIA-165 Make node name suffix UUIDs become more readable
  • Loading branch information
mxmrlv committed May 9, 2017
1 parent b11fbc9 commit 1febf80dee57b837d2ed937bcdaa080bdc3bd822
Showing 2 changed files with 6 additions and 7 deletions.
@@ -549,9 +549,13 @@ def as_raw(self):
('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:
highest_name_suffix = max(int(n.name.rsplit('_', 1)[-1]) for n in self.nodes)
suffix = 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),
@@ -67,11 +67,6 @@ def store(self, model_storage):
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()

0 comments on commit 1febf80

Please sign in to comment.