Debian Codegraph @

src/ipahealthcheck/ipa/topology.py

raw symbols SCIP
1 #
2 # Copyright (C) 2019 FreeIPA Contributors see COPYING for license
3 #
4
5 import loggingscip-python python python-stdlib 3.11 logging/__init__:
6
7 from ipahealthcheck.ipa.pluginscip-python python ipahealthcheck 0.16 `ipahealthcheck.ipa.plugin`/__init__: import IPAPluginscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.plugin`/IPAPlugin#, registryscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.plugin`/registry.
8 from ipahealthcheck.core.pluginscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.plugin`/__init__: import Resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/Result#
9 from ipahealthcheck.core.pluginscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.plugin`/__init__: import durationscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/duration().
10 from ipahealthcheck.corescip-python python ipahealthcheck 0.16 `ipahealthcheck.core`/__init__: import constantsscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.constants`/__init__:
11
12 from ipalibscip-python python ipahealthcheck 0.16 ipalib/__init__: import api
13
14 loggerscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/logger. = loggingscip-python python python-stdlib 3.11 logging/__init__:.getLoggerscip-python python python-stdlib 3.11 logging/getLogger().()
15
16
17 @registryscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.plugin`/registry.
18 class IPATopologyDomainCheckscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#(IPAPluginscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.plugin`/IPAPlugin#):
19 """
20 Execute the equivalant of ipa topologysuffix-verify domain
21
22 Return any errors discovered. This can include:
23 * too many agreements
24 * connection errors
25 """
26 def report_errorsscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(self), suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(suffix), resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(result)):
27 if resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(result)['result']['in_order']:
28 yield Resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/Result#(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(self), constantsscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.constants`/__init__:.SUCCESSscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.constants`/SUCCESS., suffix=suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(suffix))
29 else:
30 max_agmts = resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(result)['result']['max_agmts']
31 connect_errors = resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(result)['result']['connect_errors']
32 max_agmts_errors = resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(result)['result']['max_agmts_errors']
33 cmsg = 'Server %(srv)s can\'t contact servers: %(replicas)s'
34 mmsg = 'Server "%(srv)s" has %(n)d agreements, recommended ' \
35 'max %(m)d'
36
37 if connect_errors:
38 for error in connect_errors:
39 msg = cmsg % {'srv': error[0],
40 'replicas': ', '.joinscip-python python python-stdlib 3.11 builtins/str#join().(error[1])}
41 yield Resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/Result#(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(self), constantsscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.constants`/__init__:.ERRORscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.constants`/ERROR.,
42 key=error[0],
43 replicas=error[2],
44 suffix=suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(suffix),
45 type='connect',
46 msg=msg)
47 if max_agmts_errors:
48 for error in max_agmts_errors:
49 msg = mmsg % {'srv': error[0],
50 'n': len(error[1]),
51 'm': max_agmts}
52 yield Resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/Result#(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(self), constantsscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.constants`/__init__:.ERRORscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.constants`/ERROR.,
53 key=error[0],
54 replicas=error[1],
55 suffix=suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(suffix),
56 type='max',
57 msg=msg)
58
59 def run_checkscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(self), suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(suffix)):
60 try:
61 result = api.Command.topologysuffix_verify(suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(suffix))
62 except Exceptionscip-python python python-stdlib 3.11 builtins/Exception# as e:
63 yield Resultscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/Result#(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(self), constantsscip-python python ipahealthcheck 0.16 `ipahealthcheck.core.constants`/__init__:.ERRORscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.constants`/ERROR.,
64 msg='topologysuffix-verify domain failed, %s' %
65 e)
66 else:
67 for r in selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(self).report_errorsscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#report_errors().(suffixscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(suffix), result):
68 yield r
69
70 requiresscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#requires. = ('dirsrv',)
71
72 @durationscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.core.plugin`/duration().
73 def checkscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#check().(selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#check().(self)):
74
75 for y in selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#check().(self).run_checkscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(u'domain'):
76 yield y
77 if api.Command.ca_is_enabled()['result']:
78 for y in selfscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#check().(self).run_checkscip-python python ipahealthcheck 0.16 `src.ipahealthcheck.ipa.topology`/IPATopologyDomainCheck#run_check().(u'ca'):
79 yield y