From e3d54b74fad45d786f4c80fff8af5245ecdd1713 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Wed, 2 Jan 2019 13:42:08 +0530 Subject: [PATCH] Catch socket.timeout for connectivity error when streaming While fetching remote templates, if there is network issue while reading data chunks socket.timeout is raised. Change-Id: I4ebb495706ea3c505a92254b1f03e326b0fa34b6 Story: #2004686 Task: 28694 --- heat/common/urlfetch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/heat/common/urlfetch.py b/heat/common/urlfetch.py index 1ef22b40c4..54cc900279 100644 --- a/heat/common/urlfetch.py +++ b/heat/common/urlfetch.py @@ -13,6 +13,8 @@ """Utility for fetching a resource (e.g. a template) from a URL.""" +import socket + from oslo_config import cfg from oslo_log import log as logging import requests @@ -74,6 +76,6 @@ def get(url, allowed_schemes=('http', 'https')): cfg.CONF.max_template_size) return result - except exceptions.RequestException as ex: + except (exceptions.RequestException, socket.timeout) as ex: LOG.info('Failed to retrieve template: %s', ex) raise URLFetchError(_('Failed to retrieve template from %s') % url)