mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
parent
a730b6e7b5
commit
fe3ba33d26
@ -262,7 +262,9 @@ def del_master(realm, hostname, options):
|
|||||||
# server not up, just remove it from this server
|
# server not up, just remove it from this server
|
||||||
replica_names = [options.host]
|
replica_names = [options.host]
|
||||||
else:
|
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
|
# 5. Remove each agreement
|
||||||
for r in replica_names:
|
for r in replica_names:
|
||||||
|
@ -518,7 +518,10 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
|
|||||||
|
|
||||||
returns: hostname of orphaned server or None
|
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 = []
|
orphaned = []
|
||||||
# Connect to each remote server and see what agreements it has
|
# 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):
|
if not force and not ipautil.user_input("Continue to delete?", False):
|
||||||
sys.exit("Aborted")
|
sys.exit("Aborted")
|
||||||
continue
|
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:
|
if len(names) == 1 and names[0] == delrepl.hostname:
|
||||||
orphaned.append(replica)
|
orphaned.append(replica)
|
||||||
|
|
||||||
@ -611,7 +618,9 @@ def del_master(realm, hostname, options):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# Get list of agreements.
|
# 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:
|
else:
|
||||||
# WINSYNC replica, delete agreement from current host
|
# WINSYNC replica, delete agreement from current host
|
||||||
winsync = True
|
winsync = True
|
||||||
|
@ -373,7 +373,10 @@ class Restore(admintool.AdminTool):
|
|||||||
|
|
||||||
services_cns = [s.single_value('cn') for s in services]
|
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:
|
for host in hosts:
|
||||||
self.log.info('Disabling replication agreement on %s to %s' % (master, host))
|
self.log.info('Disabling replication agreement on %s to %s' % (master, host))
|
||||||
repl.disable_agreement(host)
|
repl.disable_agreement(host)
|
||||||
@ -385,7 +388,9 @@ class Restore(admintool.AdminTool):
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.log.critical("Unable to disable agreement on %s: %s" % (master, 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:
|
for host in hosts:
|
||||||
self.log.info('Disabling CA replication agreement on %s to %s' % (master, host))
|
self.log.info('Disabling CA replication agreement on %s to %s' % (master, host))
|
||||||
repl.hostnames = [master, host]
|
repl.hostnames = [master, host]
|
||||||
|
@ -34,7 +34,8 @@ class update_replica_attribute_lists(PreUpdate):
|
|||||||
has all the required attributes so that we don't cause replication
|
has all the required attributes so that we don't cause replication
|
||||||
storms.
|
storms.
|
||||||
"""
|
"""
|
||||||
order=MIDDLE
|
|
||||||
|
order = MIDDLE
|
||||||
|
|
||||||
def execute(self, **options):
|
def execute(self, **options):
|
||||||
# We need an IPAdmin connection to the backend
|
# 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,
|
repl = replication.ReplicationManager(api.env.realm, api.env.host,
|
||||||
None, conn=conn)
|
None, conn=conn)
|
||||||
entries = repl.find_replication_agreements()
|
|
||||||
self.log.debug("Found %d agreement(s)", len(entries))
|
# We need to update only IPA replica agreements, not winsync
|
||||||
for replica in entries:
|
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.log.debug(replica.single_value('description', None))
|
||||||
|
|
||||||
self._update_attr(repl, replica,
|
self._update_attr(repl, replica,
|
||||||
|
@ -307,20 +307,15 @@ class ReplicationManager(object):
|
|||||||
Return the list of hosts we have replication agreements.
|
Return the list of hosts we have replication agreements.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
res = []
|
|
||||||
|
|
||||||
filt = self.get_agreement_filter(IPA_REPLICA)
|
filt = self.get_agreement_filter(IPA_REPLICA)
|
||||||
try:
|
try:
|
||||||
ents = self.conn.get_entries(
|
ents = self.conn.get_entries(
|
||||||
DN(('cn', 'mapping tree'), ('cn', 'config')),
|
DN(('cn', 'mapping tree'), ('cn', 'config')),
|
||||||
ldap.SCOPE_SUBTREE, filt)
|
ldap.SCOPE_SUBTREE, filt)
|
||||||
except errors.NotFound:
|
except errors.NotFound:
|
||||||
return res
|
ents = []
|
||||||
|
|
||||||
for ent in ents:
|
return ents
|
||||||
res.append(ent.single_value('nsds5replicahost', None))
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
|
||||||
def get_replication_agreement(self, hostname):
|
def get_replication_agreement(self, hostname):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user