summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2013-04-08 14:09:16 +0200
committerRob Crittenden <rcritten@redhat.com>2013-04-16 10:05:43 -0400
commitfe3ba33d263a985f12c6b7b1ec342cde2babd830 (patch)
tree8f9721727120ec0f6b8c28e9942cb752147eb514
parenta730b6e7b5e4eca754022fd3e0112ef597888c3b (diff)
downloadfreeipa.git-fe3ba33d263a985f12c6b7b1ec342cde2babd830.tar.gz
freeipa.git-fe3ba33d263a985f12c6b7b1ec342cde2babd830.tar.xz
freeipa.git-fe3ba33d263a985f12c6b7b1ec342cde2babd830.zip
Update only selected attributes for winsync agreement
Trying to insert nsDS5ReplicatedAttributeListTotal and nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors. With this patch, these attributes are skipped for winsync agreements. Made find_ipa_replication_agreements() in replication.py more corresponding to find_replication_agreements. It returns list of entries instead of unicode strings now. https://fedorahosted.org/freeipa/ticket/3522
-rwxr-xr-xinstall/tools/ipa-csreplica-manage4
-rwxr-xr-xinstall/tools/ipa-replica-manage15
-rw-r--r--ipaserver/install/ipa_restore.py9
-rw-r--r--ipaserver/install/plugins/fix_replica_agreements.py13
-rw-r--r--ipaserver/install/replication.py9
5 files changed, 33 insertions, 17 deletions
diff --git a/install/tools/ipa-csreplica-manage b/install/tools/ipa-csreplica-manage
index d70f24e2..4e11ffde 100755
--- a/install/tools/ipa-csreplica-manage
+++ b/install/tools/ipa-csreplica-manage
@@ -262,7 +262,9 @@ def del_master(realm, hostname, options):
# server not up, just remove it from this server
replica_names = [options.host]
else:
- replica_names = delrepl.find_ipa_replication_agreements()
+ replica_entries = delrepl.find_ipa_replication_agreements()
+ replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
# 5. Remove each agreement
for r in replica_names:
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 8ab4dc54..ecb26381 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -518,7 +518,10 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
returns: hostname of orphaned server or None
"""
- replica_names = delrepl.find_ipa_replication_agreements()
+ replica_entries = delrepl.find_ipa_replication_agreements()
+
+ replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
orphaned = []
# Connect to each remote server and see what agreements it has
@@ -531,7 +534,11 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
if not force and not ipautil.user_input("Continue to delete?", False):
sys.exit("Aborted")
continue
- names = repl.find_ipa_replication_agreements()
+
+ entries = repl.find_ipa_replication_agreements()
+ names = [rep.single_value('nsds5replicahost', None)
+ for rep in entries]
+
if len(names) == 1 and names[0] == delrepl.hostname:
orphaned.append(replica)
@@ -611,7 +618,9 @@ def del_master(realm, hostname, options):
pass
else:
# Get list of agreements.
- replica_names = delrepl.find_ipa_replication_agreements()
+ replica_entries = delrepl.find_ipa_replication_agreements()
+ replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
else:
# WINSYNC replica, delete agreement from current host
winsync = True
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
index 04d42100..760da0ba 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -373,7 +373,10 @@ class Restore(admintool.AdminTool):
services_cns = [s.single_value('cn') for s in services]
- hosts = repl.find_ipa_replication_agreements()
+ host_entries = repl.find_ipa_replication_agreements()
+ hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
+
for host in hosts:
self.log.info('Disabling replication agreement on %s to %s' % (master, host))
repl.disable_agreement(host)
@@ -385,7 +388,9 @@ class Restore(admintool.AdminTool):
except Exception, e:
self.log.critical("Unable to disable agreement on %s: %s" % (master, e))
- hosts = repl.find_ipa_replication_agreements()
+ host_entries = repl.find_ipa_replication_agreements()
+ hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
for host in hosts:
self.log.info('Disabling CA replication agreement on %s to %s' % (master, host))
repl.hostnames = [master, host]
diff --git a/ipaserver/install/plugins/fix_replica_agreements.py b/ipaserver/install/plugins/fix_replica_agreements.py
index 472e5021..4f656924 100644
--- a/ipaserver/install/plugins/fix_replica_agreements.py
+++ b/ipaserver/install/plugins/fix_replica_agreements.py
@@ -34,7 +34,8 @@ class update_replica_attribute_lists(PreUpdate):
has all the required attributes so that we don't cause replication
storms.
"""
- order=MIDDLE
+
+ order = MIDDLE
def execute(self, **options):
# We need an IPAdmin connection to the backend
@@ -44,9 +45,13 @@ class update_replica_attribute_lists(PreUpdate):
repl = replication.ReplicationManager(api.env.realm, api.env.host,
None, conn=conn)
- entries = repl.find_replication_agreements()
- self.log.debug("Found %d agreement(s)", len(entries))
- for replica in entries:
+
+ # We need to update only IPA replica agreements, not winsync
+ ipa_replicas = repl.find_ipa_replication_agreements()
+
+ self.log.debug("Found %d agreement(s)", len(ipa_replicas))
+
+ for replica in ipa_replicas:
self.log.debug(replica.single_value('description', None))
self._update_attr(repl, replica,
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 64c3902a..6269ba68 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -307,20 +307,15 @@ class ReplicationManager(object):
Return the list of hosts we have replication agreements.
"""
- res = []
-
filt = self.get_agreement_filter(IPA_REPLICA)
try:
ents = self.conn.get_entries(
DN(('cn', 'mapping tree'), ('cn', 'config')),
ldap.SCOPE_SUBTREE, filt)
except errors.NotFound:
- return res
-
- for ent in ents:
- res.append(ent.single_value('nsds5replicahost', None))
+ ents = []
- return res
+ return ents
def get_replication_agreement(self, hostname):
"""