Change 'get_main_vip()' function so that it could treat both ipv4 and

ipv6 addresses

Change-Id: I86424689a92153e8bf6c60703a0c6eb86f297cde
This commit is contained in:
Julia Marciano 2020-11-23 22:55:24 +02:00 committed by Julia Mariano
parent 1eac0e0b9a
commit 4dd242ee47
1 changed files with 6 additions and 6 deletions

View File

@ -1,9 +1,9 @@
from __future__ import absolute_import
import re
import time
import random
import urllib.parse
from oslo_log import log
@ -171,11 +171,11 @@ def reboot_all_controller_nodes(reboot_method=sh.hard_reset_method,
def get_main_vip():
"""return the ip of the overcloud main_vip"""
credentials = keystone.default_keystone_credentials()
auth_url = credentials.auth_url
auth_url_ip = re.findall(r'[0-9]+(?:\.[0-9]+){3}', auth_url)[0]
return auth_url_ip
"""return the ip of the overcloud main vip.
Retreive an ip address (ipv4/ipv6) from the auth_url."""
auth_url = keystone.default_keystone_credentials().auth_url
auth_url_parsed = urllib.parse.urlsplit(auth_url)
return auth_url_parsed.hostname
def get_main_vip_controller(main_vip):