More resolved TODOs

This commit is contained in:
AlexSSD7 2023-08-31 20:17:55 +01:00
commit 07e3705f09
4 changed files with 26 additions and 15 deletions

View file

@ -42,9 +42,13 @@ func (s *Storage) ReleaseNetTapAllocation(tapName string) error {
return errors.Wrap(err, "get alloc file path")
}
// TODO: Check what happens the file doesn't exist. It should not return an error.
err = os.Remove(allocFilePath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
s.logger.Warn("Attempted to remove non-existent tap allocation", "tap-name", tapName)
return nil
}
return errors.Wrap(err, "remove alloc file")
}