@@ -68,19 +68,14 @@ type (
6868
6969 fileManagerServiceInterface interface {
7070 UpdateOverview (ctx context.Context , instanceID string , filesToUpdate []* mpi.File , iteration int ) error
71- ConfigApply (
72- ctx context.Context ,
73- configApplyRequest * mpi.ConfigApplyRequest ,
74- ) (writeStatus model.WriteStatus , err error )
71+ ConfigApply (ctx context.Context , configApplyRequest * mpi.ConfigApplyRequest ) (writeStatus model.WriteStatus ,
72+ err error )
7573 Rollback (ctx context.Context , instanceID string ) error
7674 UpdateFile (ctx context.Context , instanceID string , fileToUpdate * mpi.File ) error
7775 ClearCache ()
7876 UpdateCurrentFilesOnDisk (ctx context.Context , updateFiles map [string ]* mpi.File , referenced bool ) error
79- DetermineFileActions (
80- ctx context.Context ,
81- currentFiles map [string ]* mpi.File ,
82- modifiedFiles map [string ]* model.FileCache ,
83- ) (map [string ]* model.FileCache , map [string ][]byte , error )
77+ DetermineFileActions (currentFiles map [string ]* mpi.File , modifiedFiles map [string ]* model.FileCache ) (
78+ map [string ]* model.FileCache , map [string ][]byte , error )
8479 IsConnected () bool
8580 SetIsConnected (isConnected bool )
8681 }
@@ -510,11 +505,8 @@ func (fms *FileManagerService) ConfigApply(ctx context.Context,
510505 return model .Error , allowedErr
511506 }
512507
513- diffFiles , fileContent , compareErr := fms .DetermineFileActions (
514- ctx ,
515- fms .currentFilesOnDisk ,
516- ConvertToMapOfFileCache (fileOverview .GetFiles ()),
517- )
508+ diffFiles , fileContent , compareErr := fms .DetermineFileActions (fms .currentFilesOnDisk ,
509+ ConvertToMapOfFileCache (fileOverview .GetFiles ()))
518510
519511 if compareErr != nil {
520512 return model .Error , compareErr
@@ -549,7 +541,7 @@ func (fms *FileManagerService) ClearCache() {
549541
550542// nolint:revive,cyclop
551543func (fms * FileManagerService ) Rollback (ctx context.Context , instanceID string ) error {
552- slog .InfoContext (ctx , "Rolling back config for instance" , "instance_id " , instanceID )
544+ slog .InfoContext (ctx , "Rolling back config for instance" , "instanceid " , instanceID )
553545
554546 fms .filesMutex .Lock ()
555547 defer fms .filesMutex .Unlock ()
@@ -718,7 +710,6 @@ func (fms *FileManagerService) checkAllowedDirectory(checkFiles []*mpi.File) err
718710// that have changed and a map of the contents for each updated and deleted file. Key to both maps is file path
719711// nolint: revive,cyclop,gocognit
720712func (fms * FileManagerService ) DetermineFileActions (
721- ctx context.Context ,
722713 currentFiles map [string ]* mpi.File ,
723714 modifiedFiles map [string ]* model.FileCache ,
724715) (
@@ -741,7 +732,6 @@ func (fms *FileManagerService) DetermineFileActions(
741732 return nil , nil , manifestFileErr
742733 }
743734 }
744-
745735 // if file is in manifestFiles but not in modified files, file has been deleted
746736 // copy contents, set file action
747737 for fileName , manifestFile := range filesMap {
@@ -751,12 +741,7 @@ func (fms *FileManagerService) DetermineFileActions(
751741 // Read file contents before marking it deleted
752742 fileContent , readErr := os .ReadFile (fileName )
753743 if readErr != nil {
754- if errors .Is (readErr , os .ErrNotExist ) {
755- slog .DebugContext (ctx , "Unable to backup file contents since file does not exist" , "file" , fileName )
756- continue
757- } else {
758- return nil , nil , fmt .Errorf ("error reading file %s: %w" , fileName , readErr )
759- }
744+ return nil , nil , fmt .Errorf ("error reading file %s: %w" , fileName , readErr )
760745 }
761746 fileContents [fileName ] = fileContent
762747
0 commit comments