From 1c70e9ed1ba6b9d1472f2ca9825740ac4c537c50 Mon Sep 17 00:00:00 2001 From: Shubhendu Date: Mon, 15 Apr 2024 15:10:39 +0530 Subject: [PATCH] ILM expiry replication status only if enabled (#19503) Report ILM expiry replication status only if atleast one site has the feature enabled. Signed-off-by: Shubhendu Ram Tripathi --- cmd/admin-handlers-site-replication.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/admin-handlers-site-replication.go b/cmd/admin-handlers-site-replication.go index b50a4d5f5..3ae0a0283 100644 --- a/cmd/admin-handlers-site-replication.go +++ b/cmd/admin-handlers-site-replication.go @@ -347,6 +347,18 @@ func (a adminAPIHandlers) SiteReplicationStatus(w http.ResponseWriter, r *http.R writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL) return } + // Report the ILMExpiryStats only if at least one site has replication of ILM expiry enabled + var replicateILMExpiry bool + for _, site := range info.Sites { + if site.ReplicateILMExpiry { + replicateILMExpiry = true + break + } + } + if !replicateILMExpiry { + // explicitly send nil for ILMExpiryStats + info.ILMExpiryStats = nil + } if err = json.NewEncoder(w).Encode(info); err != nil { writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)