Exemplo n.º 1
0
def add_change(action_name: str,
               text: LogMessage,
               object_ref: Optional[ObjectRef] = None,
               diff_text: Optional[str] = None,
               add_user: bool = True,
               need_sync: Optional[bool] = None,
               need_restart: Optional[bool] = None,
               domains: Optional[List[Type[ABCConfigDomain]]] = None,
               sites: Optional[List[SiteId]] = None) -> None:

    log_audit(action=action_name,
              message=text,
              object_ref=object_ref,
              user_id=config.user.id if add_user else UserId(''),
              diff_text=diff_text)
    cmk.gui.watolib.sidebar_reload.need_sidebar_reload()

    search.update_index_background(action_name)

    # On each change to the Checkmk configuration mark the agents to be rebuild
    # TODO: Really? Why?
    #if has_agent_bakery():
    #    import cmk.gui.cee.agent_bakery as agent_bakery
    #    agent_bakery.mark_need_to_bake_agents()

    ActivateChangesWriter().add_change(action_name, text, object_ref, add_user,
                                       need_sync, need_restart, domains, sites)
Exemplo n.º 2
0
def add_change(
    action_name: str,
    text: LogMessage,
    object_ref: Optional[ObjectRef] = None,
    diff_text: Optional[str] = None,
    add_user: bool = True,
    need_sync: Optional[bool] = None,
    need_restart: Optional[bool] = None,
    domains: Optional[List[Type[ABCConfigDomain]]] = None,
    sites: Optional[List[SiteId]] = None,
    domain_settings: Optional[DomainSettings] = None,
) -> None:

    log_audit(
        action=action_name,
        message=text,
        object_ref=object_ref,
        user_id=user.id if add_user else UserId(""),
        diff_text=diff_text,
    )
    cmk.gui.watolib.sidebar_reload.need_sidebar_reload()

    search.update_index_background(action_name)

    ActivateChangesWriter().add_change(
        action_name,
        text,
        object_ref,
        add_user,
        need_sync,
        need_restart,
        domains,
        sites,
        domain_settings,
    )