summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration/host.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-12-11 19:33:30 +0100
committerPetr Viktorin <pviktori@redhat.com>2014-03-05 10:00:58 +0100
commit310d8254ed7659e39f61a7ff9f7eedc8a001be45 (patch)
treedf3463e0f0696a778281d79639b882fb7e3a7f80 /ipatests/test_integration/host.py
parente1b73c18e3bcbd63a67636cdb3a64bb96eab1c52 (diff)
downloadfreeipa-310d8254ed7659e39f61a7ff9f7eedc8a001be45.tar.gz
freeipa-310d8254ed7659e39f61a7ff9f7eedc8a001be45.tar.xz
freeipa-310d8254ed7659e39f61a7ff9f7eedc8a001be45.zip
test_integration.config: Do not store the index in Domain and Host objects
The index is a detail of the environment variable method of configuration, it should only be used there. Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipatests/test_integration/host.py')
-rw-r--r--ipatests/test_integration/host.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/ipatests/test_integration/host.py b/ipatests/test_integration/host.py
index a35602a97..58f1fe4d9 100644
--- a/ipatests/test_integration/host.py
+++ b/ipatests/test_integration/host.py
@@ -32,11 +32,10 @@ class BaseHost(object):
"""Representation of a remote IPA host"""
transport_class = None
- def __init__(self, domain, hostname, role, index, ip=None,
+ def __init__(self, domain, hostname, role, ip=None,
external_hostname=None):
self.domain = domain
self.role = role
- self.index = index
shortname, dot, ext_domain = hostname.partition('.')
self.shortname = shortname
@@ -94,11 +93,11 @@ class BaseHost(object):
self.log_collectors.remove(collector)
@classmethod
- def from_env(cls, env, domain, hostname, role, index):
+ def from_env(cls, env, domain, hostname, role, index, domain_index):
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)
+ '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
# type, as we assume all Unix machines are in the Unix domain and
@@ -109,7 +108,7 @@ class BaseHost(object):
else:
cls = Host
- self = cls(domain, hostname, role, index, ip, external_hostname)
+ self = cls(domain, hostname, role, ip, external_hostname)
return self
@property
@@ -120,9 +119,12 @@ class BaseHost(object):
"""Return environment variables specific to this host"""
env = self.domain.to_env(**kwargs)
+ index = self.domain.hosts.index(self) + 1
+ domain_index = self.config.domains.index(self.domain) + 1
+
role = self.role.upper()
if self.role != 'master':
- role += str(self.index)
+ role += str(index)
env['MYHOSTNAME'] = self.hostname
env['MYBEAKERHOSTNAME'] = self.external_hostname
@@ -130,8 +132,9 @@ class BaseHost(object):
prefix = ('' if self.role in self.domain.static_roles
else TESTHOST_PREFIX)
- env['MYROLE'] = '%s%s%s' % (prefix, role, self.domain._env)
- env['MYENV'] = str(self.domain.index)
+ env_suffix = '_env%s' % domain_index
+ env['MYROLE'] = '%s%s%s' % (prefix, role, env_suffix)
+ env['MYENV'] = str(domain_index)
return env