fix: if path for sqlite database file not exists, web server not work.

pull/105/head v3.0.0.2-ctp
Apex Lu 2017-12-18 04:19:37 +08:00
parent c68bbc6f3f
commit aedea7d3c7
3 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,7 @@
<file url="file://$PROJECT_DIR$/tp_core/core/ts_session.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/tp_core/core/ts_web_rpc.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/tp_core/core/ts_web_rpc.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/tp_core/protocol/rdp/rdp_proxy.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/tp_core/protocol/ssh/ssh_proxy.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/tp_core/protocol/ssh/ssh_proxy.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/tp_core/protocol/ssh/ssh_recorder.cpp" charset="GBK" />

View File

@ -34,7 +34,7 @@ core-server-rpc=http://127.0.0.1:52080/rpc
; database in use, should be sqlite/mysql, default to sqlite.
; type=sqlite
; sqlite-file=/var/lib/teleport/data/ts_db.db
; sqlite-file=/usr/local/teleport/data/db/teleport.db
; mysql-host=127.0.0.1

View File

@ -122,6 +122,11 @@ class TPDatabase:
self._conn_pool = TPSqlitePool(db_file)
if not os.path.exists(db_file):
p = os.path.dirname(os.path.abspath(db_file))
if not os.path.exists(p):
os.makedirs(p)
log.w('database need create.\n')
self.need_create = True
return True