]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Display error message on invalid template URL
authorTomas Sedovic <tomas@sedovic.cz>
Wed, 21 Mar 2012 16:07:14 +0000 (17:07 +0100)
committerTomas Sedovic <tomas@sedovic.cz>
Wed, 21 Mar 2012 16:07:14 +0000 (17:07 +0100)
Fixes #19

heat/api/v1/stacks.py

index da875f0eaa54db9a5c856d287d38c42bcfcef056..86761cedb3bc27e86ad6f11827d3ada67ad00df5 100644 (file)
@@ -20,6 +20,7 @@ import httplib
 import json
 import logging
 import os
+import socket
 import sys
 import urlparse
 
@@ -104,7 +105,11 @@ class StackController(object):
         """
         c = engine.get_engine_client(req.context)
 
-        templ = self._get_template(req)
+        try:
+            templ = self._get_template(req)
+        except socket.gaierror:
+            msg = _('Invalid Template URL')
+            return webob.exc.HTTPBadRequest(explanation=msg)
         if templ is None:
             msg = _("TemplateBody or TemplateUrl were not given.")
             return webob.exc.HTTPBadRequest(explanation=msg)