소스 검색

etcdctl: snapshot status error for non-existent file

Gyu-Ho Lee 9 년 전
부모
커밋
a78ece4ac2
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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)