Skip to content

Commit

Permalink
CSPL-2034: Address log formatting errors, which is causing operator t…
Browse files Browse the repository at this point in the history
…o crash
  • Loading branch information
sgontla committed Sep 13, 2022
1 parent 7098178 commit c99ade0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/splunk/enterprise/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,11 @@ func getAvailableDiskSpace(ctx context.Context) (uint64, error) {

err := syscall.Statfs(splcommon.AppDownloadVolume, &stat)
if err != nil {
scopedLog.Error(err, "There is no volume configured for the App framework, use the temporary location: %s", TmpAppDownloadDir)
scopedLog.Error(err, "There is no default volume configured for the App framework, use the temporary location", "dir", TmpAppDownloadDir)
splcommon.AppDownloadVolume = TmpAppDownloadDir
err = os.MkdirAll(splcommon.AppDownloadVolume, 0755)
if err != nil {
scopedLog.Error(err, "Unable to create the directory %s", splcommon.AppDownloadVolume)
scopedLog.Error(err, "Unable to create the directory", "dir", splcommon.AppDownloadVolume)
return 0, err
}
}
Expand Down Expand Up @@ -980,7 +980,7 @@ func handleAppRepoChanges(ctx context.Context, client splcommon.ControllerClient
// If the AppSrc is missing mark all the corresponding apps for deletion
if !CheckIfAppSrcExistsInConfig(appFrameworkConfig, appSrc) ||
!checkIfAppSrcExistsWithRemoteListing(appSrc, remoteObjListingMap) {
scopedLog.Info("App change", "deleting/disabling all the apps for App source: ", appSrc, "Reason: App source is mising in config or remote listing")
scopedLog.Info("App change: App source is missing in config or remote listing, deleting/disabling all the apps", "App source", appSrc)
curAppDeployList := appSrcDeploymentInfo.AppDeploymentInfoList
var modified bool

Expand All @@ -1001,8 +1001,9 @@ func handleAppRepoChanges(ctx context.Context, client splcommon.ControllerClient
if appSrcExistsLocally {
currentList := appSrcDeploymentInfo.AppDeploymentInfoList
for appIdx := range currentList {
if !isAppRepoStateDeleted(appSrcDeploymentInfo.AppDeploymentInfoList[appIdx]) && !checkIfAnAppIsActiveOnRemoteStore(currentList[appIdx].AppName, s3Response.Objects) {
scopedLog.Info("App change", "deleting/disabling the App: ", currentList[appIdx].AppName, "as it is missing in the remote listing", nil)
if !isAppRepoStateDeleted(appSrcDeploymentInfo.AppDeploymentInfoList[appIdx]) &&
!checkIfAnAppIsActiveOnRemoteStore(currentList[appIdx].AppName, s3Response.Objects) {
scopedLog.Info("App change: deleting/disabling the App, as it is missing in the remote listing", "App name", currentList[appIdx].AppName)
setStateAndStatusForAppDeployInfo(&currentList[appIdx], enterpriseApi.RepoStateDeleted, enterpriseApi.DeployStatusComplete)
}
}
Expand Down Expand Up @@ -1058,7 +1059,7 @@ func AddOrUpdateAppSrcDeploymentInfoList(ctx context.Context, appSrcDeploymentIn
for _, remoteObj := range remoteS3ObjList {
receivedKey := *remoteObj.Key
if !isAppExtentionValid(receivedKey) {
scopedLog.Error(nil, "App name Parsing: Ignoring the key with invalid extention", "receivedKey", receivedKey)
scopedLog.Error(nil, "App name Parsing: Ignoring the key with invalid extension", "receivedKey", receivedKey)
continue
}

Expand Down

0 comments on commit c99ade0

Please sign in to comment.