sometimes gethostbyname fails

fallback to 127.0.0.1

Change-Id: Ie92424a08c1d1cd3d09d173a1d7e8e08da279bfc
This commit is contained in:
Eyal 2018-03-28 12:55:37 +03:00
parent cc7547df67
commit 997f480403

View File

@ -36,7 +36,12 @@ def get_from_terminal(command):
def run_vitrage_command(command, conf):
# AUTH_URL
local_ip = socket.gethostbyname(socket.gethostname())
local_ip = '127.0.0.1'
try:
local_ip = socket.gethostbyname(socket.gethostname())
except socket.error:
LOG.info("didn't get local ip using default hostname=%s",
socket.gethostname())
auth_url = get_property_value('OS_AUTH_URL', 'auth_url',
'http://%s:5000/v2.0' % local_ip, conf)
auth_url_param = '--os-auth-url ' + auth_url