Passes lint, fixes an issue with replica installation failures due to
absence of corresponding reverse zone on master.

-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 8d905385ae16d5227248f8ebb98abf0a6b9ee932 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 8 Jan 2016 09:46:55 +0100
Subject: [PATCH] A workaround for ticket 5559

In some evironments, specifically - under test environment in RedHat's lab,
the reverse zones for VM's are managed centrally and do not get dynamically
updated during IPA  master and client installallation, which causes failures in
replica installation. This patch enables explicit reverse zone creation for
every installed client.
---
 ipatests/test_integration/tasks.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index e7984f35fc6b3d3fec93f303b1022136c325db71..08fd088181b7e833445151e7552529d45a87cc9b 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -68,6 +68,7 @@ def prepare_reverse_zone(host, ip):
     host.run_command(["ipa",
                       "dnszone-add",
                       zone], raiseonerr=False)
+    return zone
 
 def prepare_host(host):
     if isinstance(host, Host):
@@ -296,6 +297,13 @@ def install_master(host, setup_dns=True, setup_kra=False):
 
     kinit_admin(host)
 
+# Workaround for ticket N 5559
+    zone = prepare_reverse_zone(host, host.ip)
+    token = host.ip.split(".")[-1:][0]
+    host.run_command(["ipa", "dnsrecord-add", zone, token,
+                      "--ptr-hostname=%s." % host.hostname
+    ])
+# End of workaround
 
 def get_replica_filename(replica):
     return os.path.join(replica.config.test_dir, 'replica-info.gpg')
@@ -316,10 +324,11 @@ def domainlevel(host):
 def replica_prepare(master, replica):
     apply_common_fixes(replica)
     fix_apache_semaphores(replica)
-    prepare_reverse_zone(master, replica.ip)
+    zone = prepare_reverse_zone(master, replica.ip)
     master.run_command(['ipa-replica-prepare',
                         '-p', replica.config.dirman_password,
                         '--ip-address', replica.ip,
+                        "--reverse-zone=%s" % zone,
                         replica.hostname])
     replica_bundle = master.get_file_contents(
         paths.REPLICA_INFO_GPG_TEMPLATE % replica.hostname)
@@ -331,7 +340,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
                     setup_kra=False):
     replica.collect_log(paths.IPAREPLICA_INSTALL_LOG)
     replica.collect_log(paths.IPAREPLICA_CONNCHECK_LOG)
-    allow_sync_ptr(master)
+
     # Otherwise ipa-client-install would not create a PTR
     # and replica installation would fail
     args = ['ipa-replica-install', '-U',
@@ -378,6 +387,10 @@ def install_client(master, client, extra_args=()):
     client.collect_log(paths.IPACLIENT_INSTALL_LOG)
 
     apply_common_fixes(client)
+    allow_sync_ptr(master)
+    zone = prepare_reverse_zone(master, client.ip)
+    master.run_command(["ipa", "dnszone-mod", zone,
+                        "--dynamic-update=TRUE"], raiseonerr=False)
 
     client.run_command(['ipa-client-install', '-U',
                         '--domain', client.domain.name,
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to