Clean up glance url handling

Make it more clear that api_servers trumps the old tuple
configuration, and warn if you are specifying an api_server with no
protocol.

Change-Id: Id3f8e90a1d85a721b5f4185dde147ac47c06f322
This commit is contained in:
Sean Dague 2015-12-07 08:21:47 -05:00
parent b5890b3c36
commit 1c18f18385
2 changed files with 16 additions and 1 deletions

View File

@ -181,12 +181,18 @@ def get_api_servers():
"""
api_servers = []
configured_servers = (['%s:%s' % (CONF.glance.host, CONF.glance.port)]
configured_servers = ([generate_glance_url()]
if CONF.glance.api_servers is None
else CONF.glance.api_servers)
for api_server in configured_servers:
if '//' not in api_server:
api_server = 'http://' + api_server
# NOTE(sdague): remove in N.
LOG.warn(
_LW("No protocol specified in for api_server '%s', "
"please update [glance] api_servers with fully "
"qualified url including scheme (http / https)"),
api_server)
o = urlparse.urlparse(api_server)
port = o.port or 80
host = o.netloc.rsplit(':', 1)[0]

View File

@ -0,0 +1,9 @@
---
prelude: >
deprecations:
- It is now deprecated to use [glance] api_servers without a
protocol scheme (http / https). This is required to support urls
throughout the system. Update any api_servers list with fully
qualified https / http urls.