summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration/tasks.py
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-01-22 13:33:41 +0100
committerPetr Viktorin <pviktori@redhat.com>2014-02-05 15:38:53 +0100
commitbaf9b4c02a668b8ccd624706e923bbf5fb85172f (patch)
tree7f881ad8d81e5e85df6f4ca9a8e5280dc82f2b52 /ipatests/test_integration/tasks.py
parent03d093d793fc53eaa1f83b23875a643be647d42a (diff)
downloadfreeipa-baf9b4c02a668b8ccd624706e923bbf5fb85172f.tar.gz
freeipa-baf9b4c02a668b8ccd624706e923bbf5fb85172f.tar.xz
freeipa-baf9b4c02a668b8ccd624706e923bbf5fb85172f.zip
ipatests: Add records for all hosts in master's domain
All the hosts in the domain have IPA master set as their only nameserver. However, the IPA master does not create records for these machines by default. This is not an big issue for clients or replicas, since those records do get created in other ways, but external hosts using their internal hostnames will not resolve. Adds an A record for each host in master's domain. https://fedorahosted.org/freeipa/ticket/4130 Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipatests/test_integration/tasks.py')
-rw-r--r--ipatests/test_integration/tasks.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 72196914f..ab027e028 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -572,6 +572,9 @@ def install_topo(topo, master, replicas, clients,
installed = {master}
if not skip_master:
install_master(master)
+
+ add_a_records_for_hosts_in_master_domain(master)
+
for parent, child in get_topo(topo)(master, replicas):
if child in installed:
log.info('Connecting replica %s to %s' % (parent, child))
@@ -632,3 +635,28 @@ def wait_for_replication(ldap, timeout=30):
break
else:
log.error('Giving up wait for replication to finish')
+
+
+def add_a_records_for_hosts_in_master_domain(master):
+ for host in master.domain.hosts:
+ # We don't need to take care of the zone creation since it is master
+ # domain
+ add_a_record(master, host)
+
+
+def add_a_record(master, host):
+ # Find out if the record is already there
+ cmd = master.run_command(['ipa',
+ 'dnsrecord-find',
+ master.domain.name,
+ host.hostname,
+ '--a-rec', host.ip],
+ raiseonerr=False)
+
+ # If not, add it
+ if cmd.returncode != 0:
+ master.run_command(['ipa',
+ 'dnsrecord-add',
+ master.domain.name,
+ host.hostname,
+ '--a-rec', host.ip])