Provide LOCAL_IP_WRAPPED as a instack env variable
This can be then be used in places that require a IP address to be wrapped in square brackets if it is IPv6. Change-Id: Idb437dee5ddec0a015c68847b9514f7bbb3f70a1
This commit is contained in:
parent
cc75481ac7
commit
24694e5fd0
@ -41,6 +41,7 @@ import novaclient as nc
|
||||
from novaclient import client as novaclient
|
||||
from novaclient import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import netutils
|
||||
import psutil
|
||||
import pystache
|
||||
import six
|
||||
@ -668,6 +669,14 @@ def _check_ipv6_enabled():
|
||||
return os.path.isfile('/proc/net/if_inet6')
|
||||
|
||||
|
||||
def _wrap_ipv6(ip):
|
||||
"""Wrap a IP address in square brackets if IPv6
|
||||
"""
|
||||
if netutils.is_valid_ipv6(ip):
|
||||
return "[%s]" % ip
|
||||
return ip
|
||||
|
||||
|
||||
def _check_sysctl():
|
||||
"""Check sysctl option availability
|
||||
|
||||
@ -1046,7 +1055,8 @@ class InstackEnvironment(dict):
|
||||
'TRIPLEO_INSTALL_USER', 'TRIPLEO_UNDERCLOUD_CONF_FILE',
|
||||
'TRIPLEO_UNDERCLOUD_PASSWORD_FILE',
|
||||
'ENABLED_POWER_INTERFACES',
|
||||
'ENABLED_MANAGEMENT_INTERFACES', 'SYSCTL_SETTINGS'}
|
||||
'ENABLED_MANAGEMENT_INTERFACES', 'SYSCTL_SETTINGS',
|
||||
'LOCAL_IP_WRAPPED'}
|
||||
"""The variables we calculate in _generate_environment call."""
|
||||
|
||||
PUPPET_KEYS = DYNAMIC_KEYS | {opt.name.upper() for _, group in list_opts()
|
||||
@ -1193,6 +1203,7 @@ def _generate_environment(instack_root):
|
||||
|
||||
instack_env['PUBLIC_INTERFACE_IP'] = instack_env['LOCAL_IP']
|
||||
instack_env['LOCAL_IP'] = instack_env['LOCAL_IP'].split('/')[0]
|
||||
instack_env['LOCAL_IP_WRAPPED'] = _wrap_ipv6(instack_env['LOCAL_IP'])
|
||||
if instack_env['UNDERCLOUD_SERVICE_CERTIFICATE']:
|
||||
instack_env['UNDERCLOUD_SERVICE_CERTIFICATE'] = os.path.abspath(
|
||||
instack_env['UNDERCLOUD_SERVICE_CERTIFICATE'])
|
||||
|
@ -8,6 +8,7 @@ python-novaclient>=9.1.0 # Apache-2.0
|
||||
python-mistralclient>=3.1.0 # Apache-2.0
|
||||
python-swiftclient>=3.2.0 # Apache-2.0
|
||||
oslo.config!=4.3.0,!=4.4.0,>=4.0.0 # Apache-2.0
|
||||
oslo.utils>=3.20.0 # Apache-2.0
|
||||
psutil>=3.2.2 # BSD
|
||||
netaddr!=0.7.16,>=0.7.13 # BSD
|
||||
netifaces>=0.10.4 # MIT
|
||||
|
@ -9,6 +9,7 @@
|
||||
"puppet-stack-config"
|
||||
]},
|
||||
"local-ip": "{{LOCAL_IP}}",
|
||||
"local-ip-wrapped": "{{LOCAL_IP_WRAPPED}}",
|
||||
"masquerade_networks": ["{{MASQUERADE_NETWORK}}"],
|
||||
"service_certificate": "{{UNDERCLOUD_SERVICE_CERTIFICATE}}",
|
||||
"public_host": "{{UNDERCLOUD_PUBLIC_HOST}}",
|
||||
|
Loading…
Reference in New Issue
Block a user