You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/04/17 15:50:48 UTC
[10/12] incubator-ariatosca git commit: now checking for
instantiation errors during service creation phase
now checking for instantiation errors during service creation phase
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/b579d104
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/b579d104
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/b579d104
Branch: refs/heads/ARIA-138-Make-logging-more-informative
Commit: b579d104047091055751acfa478cbe44371fdaa1
Parents: aaf6642
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Sat Apr 15 17:16:32 2017 +0300
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Sat Apr 15 17:16:32 2017 +0300
----------------------------------------------------------------------
aria/core.py | 5 ++++-
aria/exceptions.py | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b579d104/aria/core.py
----------------------------------------------------------------------
diff --git a/aria/core.py b/aria/core.py
index 0be53c6..3a89a16 100644
--- a/aria/core.py
+++ b/aria/core.py
@@ -67,12 +67,15 @@ class Core(object):
service_template = self.model_storage.service_template.get(service_template_id)
# creating an empty ConsumptionContext, initiating a threadlocal context
- consumption.ConsumptionContext()
+ context = consumption.ConsumptionContext()
# setting no autoflush for the duration of instantiation - this helps avoid dependency
# constraints as they're being set up
with self.model_storage._all_api_kwargs['session'].no_autoflush:
service = service_template.instantiate(None, inputs)
+ if context.validation.dump_issues():
+ raise exceptions.InstantiationError('Failed to instantiate service template')
+
# If the user didn't enter a name for this service, we'll want to auto generate it.
# But how will we ensure a unique but simple name? We'll append the services' unique id
# to the service_templates name. Since this service is not in the storage yet, we'll put it
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b579d104/aria/exceptions.py
----------------------------------------------------------------------
diff --git a/aria/exceptions.py b/aria/exceptions.py
index bdf9f78..93987dc 100644
--- a/aria/exceptions.py
+++ b/aria/exceptions.py
@@ -69,3 +69,7 @@ class DependentAvailableNodesError(AriaError):
class ParsingError(AriaError):
pass
+
+
+class InstantiationError(AriaError):
+ pass