Skip to content

Commit 5471e5a

Browse files
committed
fix: Add reason for using deprecated logger calls in DeleteEndpointStateHandler and DeleteEndpointStateHelper
1 parent de798b6 commit 5471e5a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cns/restserver/ipam.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ func verifyUpdateEndpointStateRequest(req map[string]*IPInfo) error {
13321332

13331333
func (service *HTTPRestService) DeleteEndpointStateHandler(w http.ResponseWriter, r *http.Request) {
13341334
opName := "DeleteEndpointStateHandler"
1335-
logger.Printf("[DeleteEndpointStateHandler] DeleteEndpointState for %s", r.URL.Path) //nolint:staticcheck
1335+
logger.Printf("[DeleteEndpointStateHandler] DeleteEndpointState for %s", r.URL.Path) //nolint:staticcheck // reason: using deprecated call until migration to new API
13361336
endpointID := strings.TrimPrefix(r.URL.Path, cns.EndpointPath)
13371337

13381338
if service.EndpointStateStore == nil {
@@ -1341,15 +1341,15 @@ func (service *HTTPRestService) DeleteEndpointStateHandler(w http.ResponseWriter
13411341
Message: "[DeleteEndpointStateHandler] EndpointStateStore is not initialized",
13421342
}
13431343
err := common.Encode(w, &response)
1344-
logger.Response(opName, response, response.ReturnCode, err) //nolint:staticcheck
1344+
logger.Response(opName, response, response.ReturnCode, err) //nolint:staticcheck // reason: using deprecated call until migration to new API
13451345
return
13461346
}
13471347

13481348
// Decode the request body to get ipInfo if needed
13491349
var req map[string]*IPInfo
13501350
err := common.Decode(w, r, &req)
13511351
if err != nil {
1352-
logger.Printf("[DeleteEndpointStateHandler] Failed to decode request body: %v", err) //nolint:staticcheck
1352+
logger.Printf("[DeleteEndpointStateHandler] Failed to decode request body: %v", err) //nolint:staticcheck // reason: using deprecated call until migration to new API
13531353
// Continue with deletion even if decode fails, as ipInfo might not be needed
13541354
}
13551355

@@ -1361,7 +1361,7 @@ func (service *HTTPRestService) DeleteEndpointStateHandler(w http.ResponseWriter
13611361
Message: fmt.Sprintf("[DeleteEndpointStateHandler] Failed to delete endpoint state for %s with error: %s", endpointID, err.Error()),
13621362
}
13631363
err = common.Encode(w, &response)
1364-
logger.Response(opName, response, response.ReturnCode, err) //nolint:staticcheck
1364+
logger.Response(opName, response, response.ReturnCode, err) //nolint:staticcheck // reason: using deprecated call until migration to new API
13651365
return
13661366
}
13671367

@@ -1370,17 +1370,17 @@ func (service *HTTPRestService) DeleteEndpointStateHandler(w http.ResponseWriter
13701370
Message: "[DeleteEndpointStateHandler] Endpoint state deleted successfully",
13711371
}
13721372
err = common.Encode(w, &response)
1373-
logger.Response(opName, response, response.ReturnCode, err) //nolint:staticcheck
1373+
logger.Response(opName, response, response.ReturnCode, err) //nolint:staticcheck // reason: using deprecated call until migration to new API
13741374
}
13751375

13761376
func (service *HTTPRestService) DeleteEndpointStateHelper(endpointID string) error {
13771377
if service.EndpointStateStore == nil {
13781378
return ErrStoreEmpty
13791379
}
1380-
logger.Printf("[deleteEndpointState] Deleting Endpoint state from state file %s", endpointID) //nolint:staticcheck
1380+
logger.Printf("[deleteEndpointState] Deleting Endpoint state from state file %s", endpointID) //nolint:staticcheck // reason: using deprecated call until migration to new API
13811381
_, endpointExist := service.EndpointState[endpointID]
13821382
if !endpointExist {
1383-
logger.Printf("[deleteEndpointState] endpoint could not be found in the statefile %s", endpointID) //nolint:staticcheck
1383+
logger.Printf("[deleteEndpointState] endpoint could not be found in the statefile %s", endpointID) //nolint:staticcheck // reason: using deprecated call until migration to new API
13841384
return fmt.Errorf("[deleteEndpointState] endpoint %s: %w", endpointID, ErrEndpointStateNotFound)
13851385
}
13861386

@@ -1392,6 +1392,6 @@ func (service *HTTPRestService) DeleteEndpointStateHelper(endpointID string) err
13921392
if err != nil {
13931393
return fmt.Errorf("[deleteEndpointState] failed to write endpoint state to store: %w", err)
13941394
}
1395-
logger.Printf("[deleteEndpointState] successfully deleted endpoint %s from state file", endpointID) //nolint:staticcheck
1395+
logger.Printf("[deleteEndpointState] successfully deleted endpoint %s from state file", endpointID) //nolint:staticcheck // reason: using deprecated call until migration to new API
13961396
return nil
13971397
}

0 commit comments

Comments
 (0)