Merge "Ensure no duplicate IPs are used in undercloud.conf"
This commit is contained in:
commit
df05eda304
@ -230,6 +230,44 @@ class TestNetworkSettings(base.TestCase):
|
||||
undercloud_config._process_network_args,
|
||||
env)
|
||||
|
||||
def test_undercloud_ips_duplicated_fail(self):
|
||||
env = {}
|
||||
|
||||
# local_ip == undercloud_admin_host
|
||||
self.conf.config(local_ip='192.168.24.1/24',
|
||||
undercloud_admin_host='192.168.24.1',
|
||||
undercloud_public_host='192.168.24.2',
|
||||
generate_service_certificate=True)
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
undercloud_config._process_network_args,
|
||||
env)
|
||||
|
||||
# local_ip == undercloud_public_host
|
||||
self.conf.config(local_ip='192.168.24.1/24',
|
||||
undercloud_admin_host='192.168.24.3',
|
||||
undercloud_public_host='192.168.24.1',
|
||||
generate_service_certificate=True)
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
undercloud_config._process_network_args,
|
||||
env)
|
||||
|
||||
# undercloud_admin_host == undercloud_public_host
|
||||
self.conf.config(local_ip='192.168.24.1/24',
|
||||
undercloud_admin_host='192.168.24.2',
|
||||
undercloud_public_host='192.168.24.2',
|
||||
generate_service_certificate=True)
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
undercloud_config._process_network_args,
|
||||
env)
|
||||
|
||||
# We do not care about ip duplication when ssl is disabled
|
||||
self.conf.config(local_ip='192.168.24.1/24',
|
||||
undercloud_admin_host='192.168.24.1',
|
||||
undercloud_public_host='192.168.24.2',
|
||||
generate_service_certificate=False,
|
||||
undercloud_service_certificate='')
|
||||
undercloud_config._process_network_args(env)
|
||||
|
||||
def test_start_end_all_addresses(self):
|
||||
self.conf.config(dhcp_start='192.168.24.0',
|
||||
dhcp_end='192.168.24.255',
|
||||
|
@ -359,6 +359,21 @@ def _process_network_args(env):
|
||||
env['RedisIPv6'] = True
|
||||
env['MysqlIPv6'] = True
|
||||
|
||||
# We do not use undercloud ips for env, but just validate the configured
|
||||
# value here.
|
||||
if (CONF.get('generate_service_certificate') or
|
||||
CONF.get('undercloud_service_certificate')):
|
||||
undercloud_ips = [
|
||||
CONF.local_ip.split('/')[0],
|
||||
CONF.undercloud_admin_host,
|
||||
CONF.undercloud_public_host
|
||||
]
|
||||
if len(undercloud_ips) != len(set(undercloud_ips)):
|
||||
msg = ("The same IP is used for multiple endpoints. Please use "
|
||||
"unique ips for local_ip, undercloud_admin_host and "
|
||||
"undercloud_public_host")
|
||||
raise exceptions.InvalidConfiguration(msg)
|
||||
|
||||
|
||||
def prepare_undercloud_deploy(upgrade=False, no_validations=False,
|
||||
verbose_level=1, yes=False,
|
||||
|
Loading…
Reference in New Issue
Block a user