From caca4032d18ab60a3b5c1437c81c29a3792cded9 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:03:43 +0100 Subject: [PATCH] lapi: log error "can't sinchronize with console" only if papi is enabled (#2896) --- pkg/apiserver/apiserver.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index e42ad9a98..7989cfc1d 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -250,8 +250,8 @@ func NewServer(config *csconfig.LocalApiServerCfg) (*APIServer, error) { controller.AlertsAddChan = apiClient.AlertsAddChan - if apiClient.apiClient.IsEnrolled() { - if config.ConsoleConfig.IsPAPIEnabled() { + if config.ConsoleConfig.IsPAPIEnabled() { + if apiClient.apiClient.IsEnrolled() { log.Info("Machine is enrolled in the console, Loading PAPI Client") papiClient, err = NewPAPI(apiClient, dbClient, config.ConsoleConfig, *config.PapiLogLevel) @@ -260,9 +260,9 @@ func NewServer(config *csconfig.LocalApiServerCfg) (*APIServer, error) { } controller.DecisionDeleteChan = papiClient.Channels.DeleteDecisionChannel + } else { + log.Error("Machine is not enrolled in the console, can't synchronize with the console") } - } else { - log.Errorf("Machine is not enrolled in the console, can't synchronize with the console") } }