Skip to content

Commit

Permalink
Allow removing uninitialized mounts
Browse files Browse the repository at this point in the history
Previously we were overly finicky when removing mounts.
If a mount isn't mounted or initialized we shouldn't care.
If it's in the config remove it, if not don't.

Fixes gopasspw#1746

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
  • Loading branch information
dominikschulz committed Jan 22, 2021
1 parent 61329b3 commit 8ccd988
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/store/root/mount.go
Expand Up @@ -86,10 +86,10 @@ func (r *Store) initSub(ctx context.Context, alias, path string, keys []string)
// RemoveMount removes and existing mount
func (r *Store) RemoveMount(ctx context.Context, alias string) error {
if _, found := r.mounts[alias]; !found {
return errors.Errorf("%s is not mounted", alias)
out.Warning(ctx, "%s is not mounted", alias)
}
if _, found := r.mounts[alias]; !found {
out.Print(ctx, "%s is not initialized", alias)
out.Warning(ctx, "%s is not initialized", alias)
}
delete(r.mounts, alias)
delete(r.cfg.Mounts, alias)
Expand Down

0 comments on commit 8ccd988

Please sign in to comment.