storagemgr: Actually set updated config in AddLocalStorage

This commit is contained in:
Łukasz Magiera 2020-03-09 06:56:32 +01:00
parent f17962182f
commit 4b576cde50

View File

@ -96,12 +96,18 @@ func (m *Manager) AddLocalStorage(path string) error {
return xerrors.Errorf("opening local path: %w", err) return xerrors.Errorf("opening local path: %w", err)
} }
// TODO: Locks!
sc, err := m.storage.localStorage.GetStorage() sc, err := m.storage.localStorage.GetStorage()
if err != nil { if err != nil {
return xerrors.Errorf("get storage config: %w", err) return xerrors.Errorf("get storage config: %w", err)
} }
sc.StoragePaths = append(sc.StoragePaths, config.LocalPath{Path: path}) sc.StoragePaths = append(sc.StoragePaths, config.LocalPath{Path: path})
if err := m.storage.localStorage.SetStorage(sc); err != nil {
return xerrors.Errorf("get storage config: %w", err)
}
return nil return nil
} }