Records Not Disappearing from Archived Page 98/6198/2
authorSumit Kaushik <sk00613223@TechMahindra.com>
Tue, 24 Dec 2019 15:54:48 +0000 (21:24 +0530)
committerSumit Kaushik <sk00613223@techmahindra.com>
Tue, 24 Dec 2019 16:02:36 +0000 (16:02 +0000)
ISSUE-ID : ACUMOS-3720

After Restoring Not disappearing from Archived Logs Page

Change-Id: I0f914727f61ef1c93c1aff50ca89ed2644fdf60a
Signed-off-by: Sumit Kaushik <sk00613223@TechMahindra.com>
elk-client/src/main/java/org/acumos/elk/client/service/SnapshotRepositoryServiceImpl.java
elk-client/src/main/java/org/acumos/elk/client/utils/ElkClientConstants.java

index 18df590..7d0a6ea 100644 (file)
@@ -113,7 +113,8 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                        createRepo(elkCreateRepositoriesRequest, ElkClientConstants.ARCHIVE_ES_DATA);
 
                        logger.debug("Repository is created ", acknowledged);
-               }               
+               }
+
                return String.valueOf(acknowledged);
        }
 
@@ -231,6 +232,7 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                };
 
                String result = null;
+               String resultDelete = null;
                String[] archiveInfoArray;
                List<String> resultList = new ArrayList<>();
                if (action.equalsIgnoreCase(ElkClientConstants.INFO)) {
@@ -246,7 +248,13 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                                for (String repoName : archiveRequest.getRepositoryName()) {
                                        result = ElkServiceUtils.executeScript(action, repoName);
                                        resultList.add(result.trim());
-                                       
+
+                                       if (action != null && !action.isEmpty()
+                                                       && action.equalsIgnoreCase(ElkClientConstants.RESTORE_REQUEST)) {
+                                               resultDelete = ElkServiceUtils.executeScript(ElkClientConstants.DELETE_REQUEST, repoName);
+                                       }
+
+                                       resultList.add(resultDelete.trim());
                                }
                        } catch (Exception ex) {
                                logger.debug("Exception:", ex);
index 064ade0..2c87647 100644 (file)
@@ -36,7 +36,7 @@ public final class ElkClientConstants {
        public static final String RESTORE_SNAPSHOT_REQUEST = "/restore/snapshot";
        public static final String GET_ALL_ARCHIVE_INFO = "/all/archive";
        public static final String ARCHIVE_REQUEST = "/archive/action";
-
+       
        public static final String TRUE = "true";
        public static final String TIME_ONE_MINT_OUT = "1m";
        public static final String TIME_TWO_MINT_OUT = "2m";
@@ -44,5 +44,7 @@ public final class ElkClientConstants {
        public static final String FAIL = "fail";
        public static final String INFO = "INFO";
        public static final String ARCHIVE_ES_DATA = "archive-es-data";
+       public static final String RESTORE_REQUEST = "restore";
+       public static final String DELETE_REQUEST = "delete";
        
 }