keep probing for userdata.json like before
there can be a race between server starting up and the scp happenning from the appstore
This commit is contained in:
+9
-10
@@ -70,21 +70,20 @@ function stop(callback) {
|
||||
gHttpServer = null;
|
||||
}
|
||||
|
||||
function provisionCaaS(callback) {
|
||||
function provisionCaaS() {
|
||||
var PROVISION_CONFIG_FILE = '/root/userdata.json';
|
||||
|
||||
if (fs.existsSync(PROVISION_CONFIG_FILE)) {
|
||||
var userData = require(PROVISION_CONFIG_FILE);
|
||||
installer.provision(userData, callback);
|
||||
}
|
||||
if (!fs.existsSync(PROVISION_CONFIG_FILE)) setTimeout(provisionCaaS, 5000);
|
||||
|
||||
var userData = require(PROVISION_CONFIG_FILE);
|
||||
fs.unlinkSync(PROVISION_CONFIG_FILE);
|
||||
installer.provision(userData, function (error) { console.error(error); });
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
provisionCaaS(function (error) {
|
||||
if (error) return console.error(error);
|
||||
provisionCaaS();
|
||||
|
||||
start(function (error) {
|
||||
if (error) console.error(error);
|
||||
});
|
||||
start(function (error) {
|
||||
if (error) console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user