From 997f480403e7ef547290c06ecf891428da5c5d35 Mon Sep 17 00:00:00 2001 From: Eyal Date: Wed, 28 Mar 2018 12:55:37 +0300 Subject: [PATCH] sometimes gethostbyname fails fallback to 127.0.0.1 Change-Id: Ie92424a08c1d1cd3d09d173a1d7e8e08da279bfc --- vitrage_tempest_plugin/tests/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vitrage_tempest_plugin/tests/utils.py b/vitrage_tempest_plugin/tests/utils.py index 297b521..231b6f0 100644 --- a/vitrage_tempest_plugin/tests/utils.py +++ b/vitrage_tempest_plugin/tests/utils.py @@ -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