Fix local repo matching for bootstrap image checker
Use urlparse to fetch location part and match it against a simple localhost regexp Change-Id: I09ade41fc644545526dbd082ef3ca4967a7bf57c Closes-bug: #1628880
This commit is contained in:
parent
1a94d657ec
commit
6e36349d84
|
@ -17,6 +17,7 @@ import logging
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import types
|
import types
|
||||||
|
import urlparse
|
||||||
|
|
||||||
import six
|
import six
|
||||||
import urwid
|
import urwid
|
||||||
|
@ -29,7 +30,7 @@ from fuelmenu.common import utils
|
||||||
log = logging.getLogger('fuelmenu.mirrors')
|
log = logging.getLogger('fuelmenu.mirrors')
|
||||||
blank = urwid.Divider()
|
blank = urwid.Divider()
|
||||||
|
|
||||||
local_repo_pattern = re.compile(r'^http[s]?://(127.0.0.1|localhost)([:/].*)?$')
|
localhost_pattern = re.compile(r'(127.0.0.1|localhost)')
|
||||||
|
|
||||||
|
|
||||||
BOOTSTRAP_HTTP_PROXY_KEY = "BOOTSTRAP/http_proxy"
|
BOOTSTRAP_HTTP_PROXY_KEY = "BOOTSTRAP/http_proxy"
|
||||||
|
@ -354,7 +355,8 @@ class BootstrapImage(urwid.WidgetWrap):
|
||||||
def _check_repo(self, base_url, suite, proxies):
|
def _check_repo(self, base_url, suite, proxies):
|
||||||
release_url = '{base_url}/dists/{suite}/Release'.format(
|
release_url = '{base_url}/dists/{suite}/Release'.format(
|
||||||
base_url=base_url, suite=suite)
|
base_url=base_url, suite=suite)
|
||||||
if (local_repo_pattern.search(release_url) and
|
host = urlparse.urlparse(release_url).netloc.split(':')[0]
|
||||||
|
if (localhost_pattern.search(host) and
|
||||||
utils.is_pre_deployment()):
|
utils.is_pre_deployment()):
|
||||||
# Due to pre-deployment stage we can't check accessibility of local
|
# Due to pre-deployment stage we can't check accessibility of local
|
||||||
# repository since it is not created at that moment. Although we
|
# repository since it is not created at that moment. Although we
|
||||||
|
|
Loading…
Reference in New Issue