mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #12166 from cpuguy83/remove_err_when_volume_exists
Don't return error when adding existing volume
This commit is contained in:
commit
7ecf4e5d4d
1 changed files with 5 additions and 7 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue