From 1fb35e964d8c0940326a4ef2d83188edcc0d1e8b Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Wed, 6 May 2015 03:27:52 +0300 Subject: [PATCH] Improved error reporting for HOT applications Report HOT deployment errors on behalf of failed application Change-Id: I1eb3f6979c162657298fd0917dcda24a71e56df8 Closes-Bug: #1452080 --- murano/packages/hot_package.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/murano/packages/hot_package.py b/murano/packages/hot_package.py index 53a65b6e..dd7a9211 100644 --- a/murano/packages/hot_package.py +++ b/murano/packages/hot_package.py @@ -203,6 +203,10 @@ class HotPackage(murano.packages.application_package.ApplicationPackage): for key, value in (hot.get('parameters') or {}).items(): template_parameters[key] = YAQL("$." + key) + copy_outputs = [] + for key, value in (hot.get('outputs') or {}).items(): + copy_outputs.append({YAQL('$.' + key): YAQL('$outputs.' + key)}) + deploy = [ {YAQL('$environment'): YAQL( "$.find('io.murano.Environment').require()" @@ -232,17 +236,28 @@ class HotPackage(murano.packages.application_package.ApplicationPackage): YAQL("$reporter.report($this, " "'Stack creation has started')"), - YAQL('$stack.push()'), - {YAQL('$outputs'): YAQL('$stack.output()')}, - YAQL("$reporter.report($this, " - "'Stack was successfully created')"), + { + 'Try': [YAQL('$stack.push()')], + 'Catch': [ + { + 'As': 'e', + 'Do': [ + YAQL("$reporter.report_error($this, $e.message)"), + {'Rethrow': None} + ] + } + ], + 'Else': [ + {YAQL('$outputs'): YAQL('$stack.output()')}, + {'Do': copy_outputs}, + YAQL("$reporter.report($this, " + "'Stack was successfully created')"), - YAQL("$reporter.report($this, " - "'Application deployment has finished')"), + YAQL("$reporter.report($this, " + "'Application deployment has finished')"), + ] + } ] - for key, value in (hot.get('outputs') or {}).items(): - deploy.append({YAQL('$.' + key): YAQL( - '$outputs.' + key)}) destroy = [ {YAQL('$stack'): YAQL(