|
4 | 4 | # conditions defined in the file COPYING, which is part of this source code package. |
5 | 5 |
|
6 | 6 | import json |
7 | | -from collections.abc import Mapping, Sequence |
| 7 | +from collections.abc import Sequence |
8 | 8 |
|
9 | 9 | from cmk.ccc.exceptions import MKGeneralException |
10 | 10 | from cmk.ccc.hostaddress import HostName |
11 | | -from cmk.ccc.site import SiteId |
12 | 11 |
|
13 | 12 | from cmk.utils.agent_registration import get_uuid_link_manager |
14 | 13 |
|
15 | | -from cmk.gui.config import active_config |
16 | 14 | from cmk.gui.http import request |
17 | 15 | from cmk.gui.log import logger |
18 | | -from cmk.gui.site_config import site_is_local |
19 | 16 | from cmk.gui.watolib.automation_commands import AutomationCommand |
20 | | -from cmk.gui.watolib.automations import do_remote_automation, RemoteAutomationConfig |
| 17 | +from cmk.gui.watolib.automations import ( |
| 18 | + do_remote_automation, |
| 19 | + LocalAutomationConfig, |
| 20 | + RemoteAutomationConfig, |
| 21 | +) |
21 | 22 |
|
22 | 23 |
|
23 | 24 | def remove_tls_registration( |
24 | | - hosts_by_site: Mapping[SiteId, Sequence[HostName]], *, debug: bool |
| 25 | + hosts_by_site: Sequence[ |
| 26 | + tuple[LocalAutomationConfig | RemoteAutomationConfig, Sequence[HostName]] |
| 27 | + ], |
| 28 | + *, |
| 29 | + debug: bool, |
25 | 30 | ) -> None: |
26 | | - for site_id, host_names in hosts_by_site.items(): |
| 31 | + for automation_config, host_names in hosts_by_site: |
27 | 32 | if not host_names: |
28 | 33 | continue |
29 | 34 |
|
30 | | - if site_is_local(site_config := active_config.sites[site_id], site_id): |
| 35 | + if isinstance(automation_config, LocalAutomationConfig): |
31 | 36 | _remove_tls_registration(host_names) |
32 | 37 | continue |
33 | 38 |
|
34 | 39 | do_remote_automation( |
35 | | - RemoteAutomationConfig.from_site_config(site_config), |
| 40 | + automation_config, |
36 | 41 | "remove-tls-registration", |
37 | 42 | [("host_names", json.dumps(host_names))], |
38 | 43 | debug=debug, |
|
0 commit comments