from dsadmin import DSAdmin, Entry host1, port1, dn1, pw1, host2, port2, dn2, pw2 = sys.argv[1:] srv1 = DSAdmin(host1, int(port1), dn1, pw1) srv2 = DSAdmin(host2, int(port2), dn2, pw2) agmts1to2 = srv1.findAgreementDNs() agmts2to1 = srv2.findAgreementDNs() suffixes = {} srv1.lastnumchanges = {} srv2.lastnumchanges = {} srv1.avgrate = {} srv2.avgrate = {} srv1.count = {} srv2.count = {} repls = {} for dn in agmts1to2: ents = srv1.search_s(dn, ldap.SCOPE_BASE, 'objectclass=*', ['nsDS5ReplicaRoot']) ndn = DSAdmin.normalizeDN(dn) nrr = DSAdmin.normalizeDN(ents[0].nsDS5ReplicaRoot) suffixes[nrr] = dn srv1.lastnumchanges[ndn] = 0 rdns = ldap.explode_dn(dn, 0) ndn = DSAdmin.normalizeDN(','.join(rdns[1:])) repls[ndn] = ndn for dn in agmts2to1: ents = srv2.search_s(dn, ldap.SCOPE_BASE, 'objectclass=*', ['nsDS5ReplicaRoot'])
sufary = args.b suffixes = {} conns = [] for ii in range(0, len(args.H)): ary = args.H[ii].split(':') host = ary[0] if len(ary) == 1: port = 389 else: port = int(ary[1]) conn = DSAdmin(host, port, args.D[ii], args.w[ii]) conn.lastnumchanges = {} conn.avgrate = {} conn.count = {} conn.starttime = {} conn.endtime = {} conns.append(conn) sufary = args.b if not sufary: sufary = conn.getSuffixes() for suf in sufary: filt = '(nsds5replicaroot=' + suf + ')' agmts = conn.findAgreementDNs(filt) if not agmts: raise Exception("error: server " + str(conn) + " has no agreements for suffix " + suf) suffixes[DSAdmin.normalizeDN(suf)] = suf for agmt in agmts: conn.lastnumchanges[agmt] = 0
sufary = args.b suffixes = {} conns = [] for ii in range(0, len(args.H)): ary = args.H[ii].split(':') host = ary[0] if len(ary) == 1: port = 389 else: port = int(ary[1]) conn = DSAdmin(host, port, args.D[ii], args.w[ii]) conn.lastnumchanges = {} conn.avgrate = {} conn.count = {} conn.starttime = {} conn.endtime = {} conns.append(conn) sufary = args.b if not sufary: sufary = conn.getSuffixes() for suf in sufary: filt = '(nsds5replicaroot=' + suf + ')' agmts = conn.findAgreementDNs(filt) if not agmts: # raise Exception("error: server " + str(conn) + " has no agreements for suffix " + suf) print("error: server " + str(conn) + " has no agreements for suffix " + suf + " probably a consumer") suffixes[normalizeDN(suf)] = suf for agmt in agmts: conn.lastnumchanges[agmt] = 0
from dsadmin import DSAdmin, Entry host1, port1, dn1, pw1, host2, port2, dn2, pw2 = sys.argv[1:] srv1 = DSAdmin(host1, int(port1), dn1, pw1) srv2 = DSAdmin(host2, int(port2), dn2, pw2) agmts1to2 = srv1.findAgreementDNs() agmts2to1 = srv2.findAgreementDNs() suffixes = {} srv1.lastnumchanges = {} srv2.lastnumchanges = {} srv1.avgrate = {} srv2.avgrate = {} srv1.count = {} srv2.count = {} repls = {} for dn in agmts1to2: ents = srv1.search_s(dn, ldap.SCOPE_BASE, "objectclass=*", ["nsDS5ReplicaRoot"]) ndn = DSAdmin.normalizeDN(dn) nrr = DSAdmin.normalizeDN(ents[0].nsDS5ReplicaRoot) suffixes[nrr] = dn srv1.lastnumchanges[ndn] = 0 rdns = ldap.explode_dn(dn, 0) ndn = DSAdmin.normalizeDN(",".join(rdns[1:])) repls[ndn] = ndn for dn in agmts2to1: ents = srv2.search_s(dn, ldap.SCOPE_BASE, "objectclass=*", ["nsDS5ReplicaRoot"]) ndn = DSAdmin.normalizeDN(dn) nrr = DSAdmin.normalizeDN(ents[0].nsDS5ReplicaRoot)