@@ -202,6 +202,17 @@ def domain_groups(self) -> typing.Iterable[DomainGroupEntry]:
202
202
for n , entry in enumerate (dgroups ):
203
203
yield DomainGroupEntry (self , entry , n )
204
204
205
+ def __eq__ (self , other : typing .Any ) -> bool :
206
+ if isinstance (other , InstanceConfig ) and self .iconfig == other .iconfig :
207
+ self_shares = _shares_data (self .gconfig , self .iconfig )
208
+ other_shares = _shares_data (other .gconfig , other .iconfig )
209
+ self_globals = _globals_data (self .gconfig , self .iconfig )
210
+ other_globals = _globals_data (other .gconfig , other .iconfig )
211
+ return (
212
+ self_shares == other_shares and self_globals == other_globals
213
+ )
214
+ return False
215
+
205
216
206
217
class CTDBSambaConfig :
207
218
def global_options (self ) -> typing .Iterable [typing .Tuple [str , str ]]:
@@ -341,3 +352,19 @@ def __init__(self, iconf: InstanceConfig, urec: dict, num: int):
341
352
342
353
class DomainGroupEntry (GroupEntry ):
343
354
pass
355
+
356
+
357
+ def _shares_data (gconfig : GlobalConfig , iconfig : dict ) -> list :
358
+ try :
359
+ shares = iconfig ["shares" ]
360
+ except KeyError :
361
+ return []
362
+ return [gconfig .data ["shares" ][n ] for n in shares ]
363
+
364
+
365
+ def _globals_data (gconfig : GlobalConfig , iconfig : dict ) -> list :
366
+ try :
367
+ gnames = iconfig ["globals" ]
368
+ except KeyError :
369
+ return []
370
+ return [gconfig .data ["globals" ][n ] for n in gnames ]
0 commit comments