Don't return error when adding existing volume

Error wasn't really doing anything except for making a bunch of extra
debug logs.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff 2015-04-07 21:10:39 -04:00
parent 06433cf812
commit 579c9ec1d0

View file

@ -77,7 +77,8 @@ func (r *Repository) newVolume(path string, writable bool) (*Volume, error) {
return nil, err
}
return v, r.add(v)
r.add(v)
return v, nil
}
func (r *Repository) restore() error {
@ -103,9 +104,7 @@ func (r *Repository) restore() error {
continue
}
}
if err := r.add(vol); err != nil {
logrus.Debugf("Error restoring volume: %v", err)
}
r.add(vol)
}
return nil
}
@ -125,12 +124,11 @@ func (r *Repository) get(path string) *Volume {
return r.volumes[filepath.Clean(path)]
}
func (r *Repository) add(volume *Volume) error {
func (r *Repository) add(volume *Volume) {
if vol := r.get(volume.Path); vol != nil {
return fmt.Errorf("Volume exists: %s", volume.ID)
return
}
r.volumes[volume.Path] = volume
return nil
}
func (r *Repository) Delete(path string) error {