Browse Source

Merge pull request #5110 from gyuho/error_when_db_not_exist

etcdctl: snapshot status error for non-existent file
Gyu-Ho Lee 9 years ago
parent
commit
caf0e9b9b1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      etcdctl/ctlv3/command/snapshot_command.go

+ 4 - 0
etcdctl/ctlv3/command/snapshot_command.go

@@ -297,6 +297,10 @@ type dbstatus struct {
 }
 }
 
 
 func dbStatus(p string) dbstatus {
 func dbStatus(p string) dbstatus {
+	if _, err := os.Stat(p); err != nil {
+		ExitWithError(ExitError, err)
+	}
+
 	ds := dbstatus{}
 	ds := dbstatus{}
 
 
 	db, err := bolt.Open(p, 0600, nil)
 	db, err := bolt.Open(p, 0600, nil)