daemon: ipfs daemon --offline --mount should fail with nice message

ipfs daemon --offline;
ipfs mount;
fails. This uniforms this behaviour.

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2016-08-01 13:02:14 +01:00 committed by Jeromy
parent 8405b56df0
commit 2cae0bc616
2 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package main
import (
"errors"
_ "expvar"
"fmt"
"net"
@ -338,6 +339,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
res.SetError(err, cmds.ErrNormal)
return
}
if mount && offline {
res.SetError(errors.New("mount is not supported in offline mode"),
cmds.ErrClient)
return
}
if mount {
if err := mountFuse(req); err != nil {
res.SetError(err, cmds.ErrNormal)

View File

@ -29,5 +29,10 @@ test_expect_success "no panic traces on daemon" '
test_kill_ipfs_daemon
test_expect_success "ipfs daemon --offline --mount fails - #2995" '
(test_must_fail ipfs daemon --offline --mount 2>daemon_err) &&
grep "mount is not supported in offline mode" daemon_err
'
test_done