moved service inputs population earlier in the process
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/735e01b0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/735e01b0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/735e01b0 Branch: refs/heads/ARIA-48-aria-cli Commit: 735e01b0c295d95da0a3fc5f81c024c0c03a8d5f Parents: c89703f Author: Ran Ziv <[email protected]> Authored: Mon Apr 3 01:01:00 2017 +0300 Committer: Ran Ziv <[email protected]> Committed: Thu Apr 6 11:29:17 2017 +0300 ---------------------------------------------------------------------- aria/core.py | 6 +----- aria/modeling/service_template.py | 8 +++++--- 2 files changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/735e01b0/aria/core.py ---------------------------------------------------------------------- diff --git a/aria/core.py b/aria/core.py index 5368f9c..6be6fd1 100644 --- a/aria/core.py +++ b/aria/core.py @@ -74,11 +74,7 @@ class Core(object): # creating an empty ConsumptionContext, initiating a threadlocal context ConsumptionContext() with self.model_storage._all_api_kwargs['session'].no_autoflush: - service = service_template.instantiate(None) - - template_inputs = service_template.inputs - service.inputs = modeling_utils.create_inputs(inputs, template_inputs) - # TODO: now that we have inputs, we should scan properties and inputs and evaluate functions + service = service_template.instantiate(None, inputs) service.name = service_name or '{0}_{1}'.format(service_template_name, service.id) self.model_storage.service.put(service) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/735e01b0/aria/modeling/service_template.py ---------------------------------------------------------------------- diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py index 86cf81a..1c6d393 100644 --- a/aria/modeling/service_template.py +++ b/aria/modeling/service_template.py @@ -279,7 +279,7 @@ class ServiceTemplateBase(TemplateModelMixin): ('interface_types', formatting.as_raw(self.interface_types)), ('artifact_types', formatting.as_raw(self.artifact_types)))) - def instantiate(self, container): + def instantiate(self, container, inputs=None): from . import models context = ConsumptionContext.get_thread_local() now = datetime.now() @@ -287,9 +287,12 @@ class ServiceTemplateBase(TemplateModelMixin): updated_at=now, description=deepcopy_with_locators(self.description), service_template=self) - context.modeling.instance = service + # utils.instantiate_dict(self, service.inputs, self.inputs) + service.inputs = utils.create_inputs(inputs or {}, self.inputs) + # TODO: now that we have inputs, we should scan properties and inputs and evaluate functions + utils.instantiate_dict(self, service.meta_data, self.meta_data) for node_template in self.node_templates.itervalues(): @@ -305,7 +308,6 @@ class ServiceTemplateBase(TemplateModelMixin): if self.substitution_template is not None: service.substitution = self.substitution_template.instantiate(container) - utils.instantiate_dict(self, service.inputs, self.inputs) utils.instantiate_dict(self, service.outputs, self.outputs) return service
