def _replication_agreements(self):
self._log.debug('Checking for replication agreements...')
msg = []
healthy = True
suffix = self._base_dn.replace('=', '\\3D').replace(',', '\\2C')
results = self._search(
'cn=replica,cn=%s,cn=mapping tree,cn=config' % suffix,
'(objectClass=*)',
['nsDS5ReplicaHost', 'nsds5replicaLastUpdateStatus'],
scope=ldap.SCOPE_ONELEVEL
)
for result in results:
dn, attrs = result
host = attrs['nsDS5ReplicaHost'][0].decode('utf-8')
host = host.partition('.')[0]
status = attrs['nsds5replicaLastUpdateStatus'][0].decode('utf-8')
status = status.replace('Error ', '').partition(' ')[0].strip('()')
if status != '0':
healthy = False
msg.append('%s %s' % (host, status))
return '\n'.join(msg), healthy
评论列表
文章目录