Skip to content

Commit 79329f5

Browse files
committed
fix code
Signed-off-by: Ashima-Ashima1 <[email protected]>
1 parent 285800f commit 79329f5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

controllers/logParser.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ func parseLogs(nodePodLogs string) map[string]string {
5353
if len(matches) == 2 {
5454
mapContent := matches[1]
5555

56-
getVolumeID := regexp.MustCompile("VolumeId:\\S+").FindStringSubmatch(mapContent) //nolint:gosimple
57-
volumeID := strings.Split(getVolumeID[0], ":")[1]
56+
getVolumeID := regexp.MustCompile(`VolumeId:\S+`).FindStringSubmatch(mapContent) //nolint:gosimple
57+
if len(getVolumeID) != 0 {
58+
volumeID := strings.Split(getVolumeID[0], ":")[1]
5859

59-
getErrMsg := strings.ReplaceAll(mapContent, getVolumeID[0], "")
60-
errMsg := strings.Split(getErrMsg, ":")[1]
60+
getErrMsg := strings.ReplaceAll(mapContent, getVolumeID[0], "")
61+
errMsg := strings.Split(getErrMsg, ":")[1]
6162

62-
volumesStats[volumeID] = errMsg
63+
volumesStats[volumeID] = errMsg
64+
}
6365
}
6466
}
6567
}

controllers/recoverstalevolume_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (r *RecoverStaleVolumeReconciler) Reconcile(ctx context.Context, req ctrl.R
182182
pvcName := pvcDetails.ClaimName
183183

184184
if util.Contains(pvcNames, pvcName) {
185-
reqLogger.Info("Pod details", "pod-name", podName, "pvc-name")
185+
reqLogger.Info("Pod details", "pod-name", podName, "pvc-name", pvcName)
186186
nodeName := podData.Spec.NodeName
187187
volumeData, ok := nodeVolumePodMapping[nodeName]
188188
if !ok {

0 commit comments

Comments
 (0)