diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-01-19 10:44:26 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-01-19 10:44:26 -0800 |
commit | e9007b1f569ce15780ed34b837db987eec457d2f (patch) | |
tree | abae4ea9e7317dd0de5cbdbb45379296f42427ab /service/OneService.cpp | |
parent | 0fb3d1d58239837ae058c43d7269ce7fc33f5a7c (diff) | |
download | infinitytier-e9007b1f569ce15780ed34b837db987eec457d2f.tar.gz infinitytier-e9007b1f569ce15780ed34b837db987eec457d2f.zip |
NodeJS migration script for old Sqlite controller.db to new controller data format.
Diffstat (limited to 'service/OneService.cpp')
-rw-r--r-- | service/OneService.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index b273aad4..0fd8496d 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -625,7 +625,15 @@ public: for(int i=0;i<3;++i) _portsBE[i] = Utils::hton((uint16_t)_ports[i]); - _controller = new EmbeddedNetworkController(_node,(_homePath + ZT_PATH_SEPARATOR_S + ZT_CONTROLLER_DB_PATH).c_str(),(FILE *)0); + // Check for legacy controller.db and terminate if present to prevent nasty surprises for DIY controller folks + if (OSUtils::fileExists((_homePath + ZT_PATH_SEPARATOR_S "controller.db").c_str())) { + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = "controller.db is present in our home path! run migrate-sqlite to migrate to new controller.d format."; + return _termReason; + } + + _controller = new EmbeddedNetworkController(_node,(_homePath + ZT_PATH_SEPARATOR_S ZT_CONTROLLER_DB_PATH).c_str(),(FILE *)0); _node->setNetconfMaster((void *)_controller); #ifdef ZT_ENABLE_CLUSTER |