From: Tomas Sedovic Date: Wed, 21 Mar 2012 16:07:14 +0000 (+0100) Subject: Display error message on invalid template URL X-Git-Tag: 2014.1~2172 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8acb771bb9a80ad87ddd69ba5e9b276d2405e33d;p=openstack-build%2Fheat-build.git Display error message on invalid template URL Fixes #19 --- diff --git a/heat/api/v1/stacks.py b/heat/api/v1/stacks.py index da875f0e..86761ced 100644 --- a/heat/api/v1/stacks.py +++ b/heat/api/v1/stacks.py @@ -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)