View | Details | Raw Unified | Return to bug 44902 | Differences between
and this patch

Collapse All | Expand All

(-)umc/python/diagnostic/plugins/samba_tool_showrepl.py (-13 / +14 lines)
 Lines 99-129    Link Here 
99
		return (info_type, info)
99
		return (info_type, info)
100
100
101
	def neighbours(self):
101
	def neighbours(self):
102
		(info_type, info) = self._replica_info(drsuapi.DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)
102
		for replica_info_direction in (drsuapi.DRSUAPI_DS_REPLICA_INFO_NEIGHBORS,
103
		for neighbour in info.array:
103
						drsuapi.DRSUAPI_DS_REPLICA_INFO_REPSTO):
104
			yield neighbour
104
			(info_type, info) = self._replica_info(replica_info_direction)
105
			for neighbour in info.array:
106
				yield (replica_info_direction, neighbour)
105
107
106
		(info_type, info) = self._replica_info(drsuapi.DRSUAPI_DS_REPLICA_INFO_REPSTO)
107
		for neighbour in info.array:
108
			yield neighbour
109
110
	def replication_problems(self):
108
	def replication_problems(self):
111
		for neighbour in self.neighbours():
109
		for replica_info, neighbour in self.neighbours():
112
			(ecode, estring) = neighbour.result_last_attempt
110
			(ecode, estring) = neighbour.result_last_attempt
113
			if ecode != 0:
111
			if ecode != 0:
114
				yield ReplicationProblem(neighbour)
112
				yield ReplicationProblem(replica_info, neighbour, estring)
115
113
116
114
117
class ReplicationProblem(Exception):
115
class ReplicationProblem(Exception):
118
	def __init__(self, neighbour):
116
	def __init__(self, replica_info, neighbour, estring):
119
		super(ReplicationProblem, self).__init__(neighbour)
117
		super(ReplicationProblem, self).__init__(neighbour)
120
		self.neighbour = neighbour
118
		self.neighbour = neighbour
119
		self.estring = estring
120
		self.direction = {drsuapi.DRSUAPI_DS_REPLICA_INFO_NEIGHBORS: 'Inbound',
121
		drsuapi.DRSUAPI_DS_REPLICA_INFO_REPSTO: 'Outbound'}[replica_info]
121
122
122
	def __str__(self):
123
	def __str__(self):
123
		msg = _('In {nc!r}: error during DRS replication from {source}.')
124
		msg = _('{direction} {nc!r}: error during DRS replication from {source} ({estring})')
124
		source = self._parse_ntds_dn(self.neighbour.source_dsa_obj_dn)
125
		source = self._parse_ntds_dn(self.neighbour.source_dsa_obj_dn)
125
		return msg.format(nc=self.neighbour.naming_context_dn.encode(),
126
		return msg.format(direction= self.direction, nc=self.neighbour.naming_context_dn.encode(),
126
			source=source)
127
			source=source, estring=self.estring)
127
128
128
	@staticmethod
129
	@staticmethod
129
	def _parse_ntds_dn(dn):
130
	def _parse_ntds_dn(dn):

Return to bug 44902