summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTetiana Lashchova <tlashchova@mirantis.com>2014-12-15 18:55:39 +0200
committerTetiana Lashchova <tlashchova@mirantis.com>2015-01-21 12:33:45 +0200
commit65294f43977bb3bbf0cb67a321cbff3ab5039e35 (patch)
tree513570ff610f9cc94427ddc0955d3d28fbded59e
parent4ee5264d54b7307d36e0fe169327cac488cc3986 (diff)
downloadheat-65294f43977bb3bbf0cb67a321cbff3ab5039e35.tar.gz
Check that template format plugins are registered
Otherwise log an error and exit Change-Id: I2beb33371cf5e6701e22dbb41c8f5aa681c379de Closes-Bug: #1402426 (cherry picked from commit ed76af426934147b895e2b746193491896369f82)
-rwxr-xr-xbin/heat-engine10
-rw-r--r--heat/engine/template.py11
2 files changed, 20 insertions, 1 deletions
diff --git a/bin/heat-engine b/bin/heat-engine
index fbdcd1b38..35dff2990 100755
--- a/bin/heat-engine
+++ b/bin/heat-engine
@@ -35,7 +35,9 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')):
from oslo.config import cfg
from oslo import i18n
+from heat.common.i18n import _LC
from heat.common import messaging
+from heat.engine import template
from heat.openstack.common import log as logging
from heat.openstack.common import service
@@ -51,6 +53,14 @@ if __name__ == '__main__':
logging.setup('heat')
messaging.setup()
+ mgr = None
+ try:
+ mgr = template._get_template_extension_manager()
+ except template.TemplatePluginNotRegistered as ex:
+ LOG.critical(_LC("%s"), ex)
+ if not mgr or not mgr.names():
+ sys.exit("ERROR: No template format plugins registered")
+
from heat.engine import service as engine
srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
diff --git a/heat/engine/template.py b/heat/engine/template.py
index 34b05fb9f..64c4d6724 100644
--- a/heat/engine/template.py
+++ b/heat/engine/template.py
@@ -52,7 +52,16 @@ def _get_template_extension_manager():
return extension.ExtensionManager(
namespace='heat.templates',
invoke_on_load=False,
- verify_requirements=True)
+ verify_requirements=True,
+ on_load_failure_callback=raise_extension_exception)
+
+
+def raise_extension_exception(extmanager, ep, err):
+ raise TemplatePluginNotRegistered(name=ep.name, error=six.text_type(err))
+
+
+class TemplatePluginNotRegistered(exception.HeatException):
+ msg_fmt = _("Could not load %(name)s: %(error)s")
def get_template_class(template_data):