summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2008-10-03 14:07:08 -0600
committerRob Crittenden <rcritten@redhat.com>2008-10-13 14:15:19 -0400
commiteac09d38b78867465ba44872db0ddbb4b631a4b0 (patch)
treefa4d033d12deb3eda2d755096d8f10b5655f1f97
parenta93e2b0d0215010e82496558a175b04f729ae812 (diff)
downloadfreeipa-eac09d38b78867465ba44872db0ddbb4b631a4b0.zip
freeipa-eac09d38b78867465ba44872db0ddbb4b631a4b0.tar.gz
freeipa-eac09d38b78867465ba44872db0ddbb4b631a4b0.tar.xz
Add more winsync support to cli
The ipa-replica-manage list, init, and synch commands do not work for winsync agreements. This patch adds that support and some additional verbose logging. The synch_master did not work correctly. The way it should work is to set the replication schedule to some bogus value, then reset it back to its original setting. This will force replication to take place immediately.
-rw-r--r--ipa-server/ipa-install/ipa-replica-manage16
-rw-r--r--ipa-server/ipaserver/replication.py9
2 files changed, 22 insertions, 3 deletions
diff --git a/ipa-server/ipa-install/ipa-replica-manage b/ipa-server/ipa-install/ipa-replica-manage
index c8e5735..07f36a9 100644
--- a/ipa-server/ipa-install/ipa-replica-manage
+++ b/ipa-server/ipa-install/ipa-replica-manage
@@ -50,6 +50,13 @@ def parse_options():
if not len(args) or not ("list" in args[0] or "add" in args[0] or "del" in args[0] or "init" in args[0] or "synch" in args[0]):
parser.error("must provide a command [list | add | del | init | synch]")
+ # set log level
+ if options.verbose:
+ # if verbose, output events at INFO level if not already
+ mylogger = logging.getLogger()
+ if mylogger.getEffectiveLevel() > logging.INFO:
+ mylogger.setLevel(logging.INFO)
+ # else user has already configured logging externally lower
return options, args
def get_realm_name():
@@ -114,12 +121,17 @@ def add_master(replman, hostname, options):
logging.error("Could not load the required CA certificate file [%s]" %
options.cacert)
sys.exit(1)
+ else:
+ logging.info("Added CA certificate %s to certificate database for %s" %
+ (options.cacert, replman.hostname))
# have to reconnect replman connection since the directory server was restarted
replman = replication.ReplicationManager(replman.hostname, replman.dirman_passwd)
+ logging.info("Restarted directory server " + replman.hostname)
replman.setup_replication(hostname, get_realm_name(), **other_args)
+ logging.info("Added agreement for other host " + hostname)
def init_master(replman, dirman_passwd, hostname):
- filter = "(&(nsDS5ReplicaHost=%s)(objectclass=nsds5ReplicationAgreement))" % hostname
+ filter = "(&(nsDS5ReplicaHost=%s)(|(objectclass=nsDSWindowsReplicationAgreement)(objectclass=nsds5ReplicationAgreement)))" % hostname
entry = replman.conn.search_s("cn=config", ldap.SCOPE_SUBTREE, filter)
if len(entry) == 0:
logging.error("Unable to find replication agreement for %s" % hostname)
@@ -131,7 +143,7 @@ def init_master(replman, dirman_passwd, hostname):
ds.init_memberof()
def synch_master(replman, hostname):
- filter = "(&(nsDS5ReplicaHost=%s)(objectclass=nsds5ReplicationAgreement))" % hostname
+ filter = "(&(nsDS5ReplicaHost=%s)(|(objectclass=nsDSWindowsReplicationAgreement)(objectclass=nsds5ReplicationAgreement)))" % hostname
entry = replman.conn.search_s("cn=config", ldap.SCOPE_SUBTREE, filter)
if len(entry) == 0:
logging.error("Unable to find replication agreement for %s" % hostname)
diff --git a/ipa-server/ipaserver/replication.py b/ipa-server/ipaserver/replication.py
index 3ab2e6b..8fdbed1 100644
--- a/ipa-server/ipaserver/replication.py
+++ b/ipa-server/ipaserver/replication.py
@@ -50,7 +50,7 @@ class ReplicationManager:
self.suffix = ""
def find_replication_dns(self, conn):
- filt = "(objectclass=nsDS5ReplicationAgreement)"
+ filt = "(|(objectclass=nsDSWindowsReplicationAgreement)(objectclass=nsds5ReplicationAgreement))"
try:
ents = conn.search_s("cn=mapping tree,cn=config", ldap.SCOPE_SUBTREE, filt)
except ldap.NO_SUCH_OBJECT:
@@ -372,5 +372,12 @@ class ReplicationManager:
# it back.
if newschedule == schedule:
newschedule = '2358-2359 1'
+ logging.info("Changing agreement %s schedule to %s to force synch" %
+ (dn, newschedule))
mod = [(ldap.MOD_REPLACE, 'nsDS5ReplicaUpdateSchedule', [ newschedule ])]
conn.modify_s(dn, mod)
+ time.sleep(1)
+ logging.info("Changing agreement %s to restore original schedule %s" %
+ (dn, schedule))
+ mod = [(ldap.MOD_REPLACE, 'nsDS5ReplicaUpdateSchedule', [ schedule ])]
+ conn.modify_s(dn, mod)