Move caas heartbeat code to caas.js

This commit is contained in:
Girish Ramakrishnan
2018-01-02 12:47:33 -08:00
parent 0a80bff055
commit c95684af1e
3 changed files with 14 additions and 15 deletions

View File

@@ -12,8 +12,6 @@ exports = module.exports = {
dnsSetup: dnsSetup,
getLogs: getLogs,
sendCaasHeartbeat: sendCaasHeartbeat,
updateToLatest: updateToLatest,
restore: restore,
reboot: reboot,
@@ -492,17 +490,6 @@ function getConfig(callback) {
});
}
function sendCaasHeartbeat() {
assert(config.provider() === 'caas', 'Heartbeat is only sent for managed cloudrons');
var url = config.apiServerOrigin() + '/api/v1/boxes/' + config.fqdn() + '/heartbeat';
superagent.post(url).query({ token: config.token(), version: config.version() }).timeout(30 * 1000).end(function (error, result) {
if (error && !error.response) debug('Network error sending heartbeat.', error);
else if (result.statusCode !== 200) debug('Server responded to heartbeat with %s %s', result.statusCode, result.text);
else debug('Heartbeat sent to %s', url);
});
}
function ensureDkimKey(callback) {
assert(config.fqdn(), 'fqdn is not set');