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.
Related-Bug: #1725318
Change-Id: Idb437dee5ddec0a015c68847b9514f7bbb3f70a1
(cherry picked from commit 24694e5fd0
)
This commit is contained in:
parent
0c364056dd
commit
4e47c1a1c5
@ -42,6 +42,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
|
||||
@ -670,6 +671,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
|
||||
|
||||
@ -1048,7 +1057,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()
|
||||
@ -1195,6 +1205,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.0.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