Ensure that the replication plugin exists before creeating or installing a replica.

ticket 502

rob
>From 5c751cd54b203e92db9e9d0f77f4147f717cf27b Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Mon, 13 Dec 2010 14:28:11 -0500
Subject: [PATCH] Verify that the replication plugin exists before setting up replicas.

ticket 502
---
 install/tools/ipa-replica-install |    3 +++
 install/tools/ipa-replica-prepare |    3 +++
 ipaserver/install/replication.py  |   14 ++++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install
index c9df2dd..40aa9c6 100755
--- a/install/tools/ipa-replica-install
+++ b/install/tools/ipa-replica-install
@@ -28,6 +28,7 @@ from ipapython import ipautil
 
 from ipaserver.install import dsinstance, installutils, krbinstance, service
 from ipaserver.install import bindinstance, httpinstance, ntpinstance, certs
+from ipaserver.install.replication import check_replication_plugin
 from ipaserver.plugins.ldap2 import ldap2
 from ipapython import version
 from ipalib import api, errors, util
@@ -284,6 +285,8 @@ def check_pkinit():
         sys.exit(1)
 
 def main():
+    if not check_replication_plugin():
+        sys.exit(1)
     safe_options, options, filename = parse_options()
     installutils.standard_logging_setup("/var/log/ipareplica-install.log", options.debug)
     logging.debug('%s was invoked with argument "%s" and options: %s' % (sys.argv[0], filename, safe_options))
diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index b9e3425..9d7a14b 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -29,6 +29,7 @@ from optparse import OptionParser
 from ipapython import ipautil
 from ipaserver.install import bindinstance, dsinstance, installutils, certs
 from ipaserver.install.bindinstance import add_zone, add_reverze_zone, add_rr, add_ptr_rr
+from ipaserver.install.replication import check_replication_plugin
 from ipaserver.plugins.ldap2 import ldap2
 from ipapython import version
 from ipalib import api, errors, util
@@ -228,6 +229,8 @@ def get_dirman_password():
     return installutils.read_password("Directory Manager (existing master)", confirm=False, validate=False)
 
 def main():
+    if not check_replication_plugin():
+        sys.exit(1)
     options, args = parse_options()
 
     replica_fqdn = args[0]
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index ed1badc..cdff50e 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -19,6 +19,7 @@
 
 import time, logging
 
+import os
 import ldap
 from ipaserver import ipaldap
 from ldap import modlist
@@ -39,6 +40,19 @@ WINSYNC = 2
 
 SASL_AUTH = ldap.sasl.sasl({}, 'GSSAPI')
 
+def check_replication_plugin():
+    """
+    Confirm that the 389-ds replication is installed.
+
+    Emit a message and return True/False
+    """
+    if not os.path.exists('/usr/lib/dirsrv/plugins/libreplication-plugin.so') and \
+       not os.path.exists('/usr/lib64/dirsrv/plugins/libreplication-plugin.so'):
+        print "The 389-ds replication plug-in was not found on this system"
+        return False
+
+    return True
+
 class ReplicationManager:
     """Manage replication agreements between DS servers, and sync
     agreements with Windows servers"""
-- 
1.7.2.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to