From 254e1647185813eec8752ffc54f487e7e2762890 Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Tue, 24 Sep 2024 19:03:58 +0000 Subject: [PATCH] [PLAT-15432] remove status,sizeInBytes from manifest.json file Summary: `Manifest.json` file is created before any of the support bundle components are collected so the size is always 0 and status is always running. This is the case for all support bundles and so doesn't make sense to include them in the manifest. Test Plan: created support bundle and verified that the fields are not present in manifest.json file. Reviewers: #yba-api-review!, skurapati Reviewed By: skurapati Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D38390 --- .../yw/commissioner/tasks/CreateSupportBundle.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateSupportBundle.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateSupportBundle.java index 9b4970b39fee..63f51bf19a19 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateSupportBundle.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateSupportBundle.java @@ -1,5 +1,7 @@ package com.yugabyte.yw.commissioner.tasks; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Throwables; import com.google.inject.Inject; import com.typesafe.config.Config; @@ -121,11 +123,11 @@ public Path generateBundle(SupportBundle supportBundle) // add the supportBundle metadata into the bundle try { + JsonNode sbJson = Json.toJson(supportBundle); + ((ObjectNode) sbJson).remove("status"); + ((ObjectNode) sbJson).remove("sizeInBytes"); supportBundleUtil.saveMetadata( - customer, - bundlePath.toAbsolutePath().toString(), - Json.toJson(supportBundle), - "manifest.json"); + customer, bundlePath.toAbsolutePath().toString(), sbJson, "manifest.json"); } catch (Exception e) { // Log the error and continue with the rest of support bundle collection. log.error("Error occurred while collecting support bundle manifest json", e);