()
| 64 | return nil |
| 65 | } |
| 66 | func (s *storageStruct) CheckAndMountAll() error { |
| 67 | storages, err := MyService.Storage().GetStorages() |
| 68 | if err != nil { |
| 69 | return err |
| 70 | } |
| 71 | logger.Info("when CheckAndMountAll storages", zap.Any("storages", storages)) |
| 72 | section, err := httper.GetAllConfigName() |
| 73 | if err != nil { |
| 74 | return err |
| 75 | } |
| 76 | logger.Info("when CheckAndMountAll section", zap.Any("section", section)) |
| 77 | for _, v := range section.Remotes { |
| 78 | currentRemote, _ := httper.GetConfigByName(v) |
| 79 | mountPoint := currentRemote["mount_point"] |
| 80 | if len(mountPoint) == 0 { |
| 81 | continue |
| 82 | } |
| 83 | isMount := false |
| 84 | for _, v := range storages.MountPoints { |
| 85 | if v.MountPoint == mountPoint { |
| 86 | isMount = true |
| 87 | break |
| 88 | } |
| 89 | } |
| 90 | if !isMount { |
| 91 | logger.Info("when CheckAndMountAll MountStorage", zap.String("mountPoint", mountPoint), zap.String("fs", v)) |
| 92 | err := MyService.Storage().MountStorage(mountPoint, v+":") |
| 93 | if err != nil { |
| 94 | logger.Error("when CheckAndMountAll then", zap.String("mountPoint", mountPoint), zap.String("fs", v), zap.Error(err)) |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | return nil |
| 99 | } |
| 100 | |
| 101 | func (s *storageStruct) GetConfigByName(name string) (map[string]string, error) { |
| 102 | return httper.GetConfigByName(name) |
nothing calls this directly
no test coverage detected