@@ -68,19 +68,14 @@ type (
68
68
69
69
fileManagerServiceInterface interface {
70
70
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 )
75
73
Rollback (ctx context.Context , instanceID string ) error
76
74
UpdateFile (ctx context.Context , instanceID string , fileToUpdate * mpi.File ) error
77
75
ClearCache ()
78
76
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 )
84
79
IsConnected () bool
85
80
SetIsConnected (isConnected bool )
86
81
}
@@ -510,11 +505,8 @@ func (fms *FileManagerService) ConfigApply(ctx context.Context,
510
505
return model .Error , allowedErr
511
506
}
512
507
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 ()))
518
510
519
511
if compareErr != nil {
520
512
return model .Error , compareErr
@@ -549,7 +541,7 @@ func (fms *FileManagerService) ClearCache() {
549
541
550
542
// nolint:revive,cyclop
551
543
func (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 )
553
545
554
546
fms .filesMutex .Lock ()
555
547
defer fms .filesMutex .Unlock ()
@@ -718,7 +710,6 @@ func (fms *FileManagerService) checkAllowedDirectory(checkFiles []*mpi.File) err
718
710
// that have changed and a map of the contents for each updated and deleted file. Key to both maps is file path
719
711
// nolint: revive,cyclop,gocognit
720
712
func (fms * FileManagerService ) DetermineFileActions (
721
- ctx context.Context ,
722
713
currentFiles map [string ]* mpi.File ,
723
714
modifiedFiles map [string ]* model.FileCache ,
724
715
) (
@@ -741,7 +732,6 @@ func (fms *FileManagerService) DetermineFileActions(
741
732
return nil , nil , manifestFileErr
742
733
}
743
734
}
744
-
745
735
// if file is in manifestFiles but not in modified files, file has been deleted
746
736
// copy contents, set file action
747
737
for fileName , manifestFile := range filesMap {
@@ -751,12 +741,7 @@ func (fms *FileManagerService) DetermineFileActions(
751
741
// Read file contents before marking it deleted
752
742
fileContent , readErr := os .ReadFile (fileName )
753
743
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 )
760
745
}
761
746
fileContents [fileName ] = fileContent
762
747
0 commit comments