mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
test_integration: Support external names for hosts
The framework had a concept of external hostnames, which the controller uses to contact the test machines, but they were not loaded from configuration. Load external names from configuration. This makes tests pass in setups where internal and external hostnames are different, and the internal hostnames are not initially resolvable from the controller.
This commit is contained in:
parent
af26e6da46
commit
98f4c22267
@ -236,8 +236,10 @@ def env_normalize(env):
|
|||||||
"""Fill env variables from alternate variable names
|
"""Fill env variables from alternate variable names
|
||||||
|
|
||||||
MASTER_env1 <- MASTER
|
MASTER_env1 <- MASTER
|
||||||
REPLICA_env1 <- REPLICA
|
REPLICA_env1 <- REPLICA, SLAVE
|
||||||
CLIENT_env1 <- CLIENT, SLAVE
|
CLIENT_env1 <- CLIENT
|
||||||
|
similarly for BEAKER* variants: BEAKERMASTER1_env1 <- BEAKERMASTER, etc.
|
||||||
|
|
||||||
CLIENT_env1 gets extended with CLIENT2 or CLIENT2_env1
|
CLIENT_env1 gets extended with CLIENT2 or CLIENT2_env1
|
||||||
"""
|
"""
|
||||||
def coalesce(name, *other_names):
|
def coalesce(name, *other_names):
|
||||||
@ -253,8 +255,12 @@ def env_normalize(env):
|
|||||||
else:
|
else:
|
||||||
env[name] = ''
|
env[name] = ''
|
||||||
coalesce('MASTER_env1', 'MASTER')
|
coalesce('MASTER_env1', 'MASTER')
|
||||||
coalesce('REPLICA_env1', 'REPLICA')
|
coalesce('REPLICA_env1', 'REPLICA', 'SLAVE')
|
||||||
coalesce('CLIENT_env1', 'CLIENT', 'SLAVE')
|
coalesce('CLIENT_env1', 'CLIENT')
|
||||||
|
|
||||||
|
coalesce('BEAKERMASTER1_env1', 'BEAKERMASTER')
|
||||||
|
coalesce('BEAKERREPLICA1_env1', 'BEAKERREPLICA', 'BEAKERSLAVE')
|
||||||
|
coalesce('BEAKERCLIENT1_env1', 'BEAKERCLIENT')
|
||||||
|
|
||||||
def extend(name, name2):
|
def extend(name, name2):
|
||||||
value = env.get(name2)
|
value = env.get(name2)
|
||||||
|
@ -32,7 +32,8 @@ class BaseHost(object):
|
|||||||
"""Representation of a remote IPA host"""
|
"""Representation of a remote IPA host"""
|
||||||
transport_class = None
|
transport_class = None
|
||||||
|
|
||||||
def __init__(self, domain, hostname, role, index, ip=None):
|
def __init__(self, domain, hostname, role, index, ip=None,
|
||||||
|
external_hostname=None):
|
||||||
self.domain = domain
|
self.domain = domain
|
||||||
self.role = role
|
self.role = role
|
||||||
self.index = index
|
self.index = index
|
||||||
@ -40,7 +41,7 @@ class BaseHost(object):
|
|||||||
shortname, dot, ext_domain = hostname.partition('.')
|
shortname, dot, ext_domain = hostname.partition('.')
|
||||||
self.shortname = shortname
|
self.shortname = shortname
|
||||||
self.hostname = shortname + '.' + self.domain.name
|
self.hostname = shortname + '.' + self.domain.name
|
||||||
self.external_hostname = hostname
|
self.external_hostname = external_hostname or hostname
|
||||||
|
|
||||||
self.netbios = self.domain.name.split('.')[0].upper()
|
self.netbios = self.domain.name.split('.')[0].upper()
|
||||||
|
|
||||||
@ -96,6 +97,8 @@ class BaseHost(object):
|
|||||||
def from_env(cls, env, domain, hostname, role, index):
|
def from_env(cls, env, domain, hostname, role, index):
|
||||||
ip = env.get('BEAKER%s%s_IP_env%s' %
|
ip = env.get('BEAKER%s%s_IP_env%s' %
|
||||||
(role.upper(), index, domain.index), None)
|
(role.upper(), index, domain.index), None)
|
||||||
|
external_hostname = env.get(
|
||||||
|
'BEAKER%s%s_env%s' % (role.upper(), index, domain.index), None)
|
||||||
|
|
||||||
# We need to determine the type of the host, this depends on the domain
|
# We need to determine the type of the host, this depends on the domain
|
||||||
# type, as we assume all Unix machines are in the Unix domain and
|
# type, as we assume all Unix machines are in the Unix domain and
|
||||||
@ -106,7 +109,7 @@ class BaseHost(object):
|
|||||||
else:
|
else:
|
||||||
cls = Host
|
cls = Host
|
||||||
|
|
||||||
self = cls(domain, hostname, role, index, ip)
|
self = cls(domain, hostname, role, index, ip, external_hostname)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
Reference in New Issue
Block a user