|
55 | 55 | ACTestCategories,
|
56 | 56 | ACTestRegistry,
|
57 | 57 | )
|
| 58 | +from cmk.gui.watolib.check_mk_automations import find_unknown_check_parameter_rule_sets |
58 | 59 | from cmk.gui.watolib.config_domain_name import ABCConfigDomain
|
59 | 60 | from cmk.gui.watolib.config_domains import ConfigDomainOMD
|
60 | 61 | from cmk.gui.watolib.rulesets import SingleRulesetRecursively
|
@@ -89,6 +90,7 @@ def register(ac_test_registry: ACTestRegistry) -> None:
|
89 | 90 | ac_test_registry.register(ACTestSizeOfExtensions)
|
90 | 91 | ac_test_registry.register(ACTestBrokenGUIExtension)
|
91 | 92 | ac_test_registry.register(ACTestESXDatasources)
|
| 93 | + ac_test_registry.register(ACTestUnknownCheckParameterRuleSets) |
92 | 94 | ac_test_registry.register(ACTestDeprecatedV1CheckPlugins)
|
93 | 95 | ac_test_registry.register(ACTestDeprecatedCheckPlugins)
|
94 | 96 | ac_test_registry.register(ACTestDeprecatedInventoryPlugins)
|
@@ -1332,6 +1334,50 @@ def _compute_deprecation_result(
|
1332 | 1334 | )
|
1333 | 1335 |
|
1334 | 1336 |
|
| 1337 | +class ACTestUnknownCheckParameterRuleSets(ACTest): |
| 1338 | + def category(self) -> str: |
| 1339 | + return ACTestCategories.deprecations |
| 1340 | + |
| 1341 | + def title(self) -> str: |
| 1342 | + return _("Unknown check parameter rule sets") |
| 1343 | + |
| 1344 | + def help(self) -> str: |
| 1345 | + return _( |
| 1346 | + "These rule sets are configured in your site, but not used by any check plug-in." |
| 1347 | + " There are two main reasons to have such rule sets configured:" |
| 1348 | + "<ol>" |
| 1349 | + "<li> Rule sets which were used by builtin check plugins that have been deprecated and" |
| 1350 | + " removed in the past. These can be cleaned up without any negative side effect.</li>" |
| 1351 | + "<li> Rule sets which belong to disabled or removed extension packages. If you plan to" |
| 1352 | + " keep it removed, you can safely clean them up. In case the extension package was" |
| 1353 | + " temporarily disabled, you may consider keeping the rule sets in place.</li>" |
| 1354 | + "</ol>" |
| 1355 | + ) |
| 1356 | + |
| 1357 | + def is_relevant(self) -> bool: |
| 1358 | + return True |
| 1359 | + |
| 1360 | + def execute(self) -> Iterator[ACSingleResult]: |
| 1361 | + site_id = omd_site() |
| 1362 | + if rule_sets := find_unknown_check_parameter_rule_sets().result: |
| 1363 | + for rule_set in rule_sets: |
| 1364 | + yield ACSingleResult( |
| 1365 | + state=ACResultState.CRIT, |
| 1366 | + text=( |
| 1367 | + _("Found configured rules of unknown check parameter rule set %r.") |
| 1368 | + % rule_set |
| 1369 | + ), |
| 1370 | + site_id=site_id, |
| 1371 | + ) |
| 1372 | + return |
| 1373 | + |
| 1374 | + yield ACSingleResult( |
| 1375 | + state=ACResultState.OK, |
| 1376 | + text=_("No unknown check parameter rule sets found."), |
| 1377 | + site_id=site_id, |
| 1378 | + ) |
| 1379 | + |
| 1380 | + |
1335 | 1381 | class ACTestDeprecatedV1CheckPlugins(ACTest):
|
1336 | 1382 | def category(self) -> str:
|
1337 | 1383 | return ACTestCategories.deprecations
|
|
0 commit comments