def _link_with_uuid( host_name: HostName, host: CREHost, uuid: UUID, ) -> None: uuid_link_manager = get_uuid_link_manager() uuid_link_manager.create_link( host_name, uuid, create_target_dir=host.effective_attributes().get("cmk_agent_connection") == "push-agent", )
def serialize_host(host: CREHost, effective_attributes: bool): extensions = { "folder": host.folder().path(), "attributes": host.attributes(), "effective_attributes": host.effective_attributes() if effective_attributes else None, "is_cluster": host.is_cluster(), "is_offline": host.is_offline(), "cluster_nodes": host.cluster_nodes(), } agent_links = [] if not cmk_version.is_raw_edition(): import cmk.gui.cee.agent_bakery as agent_bakery # pylint: disable=no-name-in-module for agent_type in sorted(agent_bakery.agent_package_types().keys()): agent_links.append( constructors.link_rel( rel="cmk/download", href="{}?{}".format( constructors.domain_type_action_href( "agent", "download"), urlencode({ "os_type": agent_type, "host_name": host.id() }), ), method="get", title=f"Download the {agent_type} agent of the host.", )) return constructors.domain_object( domain_type="host_config", identifier=host.id(), title=host.alias() or host.name(), links=[ constructors.link_rel( rel="cmk/folder_config", href=constructors.object_href("folder_config", folder_slug(host.folder())), method="get", title="The folder config of the host.", ), ] + agent_links, extensions=extensions, )