Use netifaces instead of facter to find ip address
Currently, neutron_350.py is using parsed output of `facter -p` in prescript_000.py which is actually not working fine in terms of getting the ip of a interface. This patch is using netifaces python library instead to get the ip address which is much easier to use and reliable. Note that netifaces was already a requirement in packstack so it's included in requirements.txt and as package requirement. Change-Id: Id4d2b4ca814129c485f491ed91bb6bb99e462114 Resolves: rhbz#1734354
This commit is contained in:
parent
3048287985
commit
7ef539bc37
@ -16,7 +16,7 @@
|
||||
Installs and configures Neutron
|
||||
"""
|
||||
|
||||
import re
|
||||
import netifaces
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
@ -807,11 +807,10 @@ def create_manifests(config, messages):
|
||||
n_host, config)
|
||||
else:
|
||||
iface = config['CONFIG_NEUTRON_OVS_TUNNEL_IF']
|
||||
ifip = ("ipaddress_%s" % iface)
|
||||
ifip = re.sub(r'[\.\-\:]', '_', ifip)
|
||||
try:
|
||||
src_host = config['HOST_DETAILS'][n_host][ifip]
|
||||
except KeyError:
|
||||
src_host = (netifaces.ifaddresses(iface)
|
||||
[netifaces.AF_INET][0]['addr'])
|
||||
except Exception:
|
||||
raise KeyError('Couldn\'t detect ipaddress of '
|
||||
'interface %s on node %s' %
|
||||
(iface, n_host))
|
||||
|
Loading…
x
Reference in New Issue
Block a user