Fix _get_listen_on_addresses to handle port 0

Port 0 is used to pick a free port during tests

Change-Id: Id3fcb854829b2d8f9e51eea19241e705f2c28e89
This commit is contained in:
Federico Ceratto 2016-05-05 20:08:18 +01:00
parent b165ce14c0
commit 40b1ad5692
1 changed files with 3 additions and 2 deletions

View File

@ -112,12 +112,13 @@ class Service(service.Service):
host = self._service_config.host
port = self._service_config.port
if host or port:
if host or port is not None:
LOG.warning(_LW("host and port config options used, the 'listen' "
"option has been ignored"))
host = host or "0.0.0.0"
port = port or default_port
# "port" might be 0 to pick a free port, usually during testing
port = default_port if port is None else port
return [(host, port)]