|
|
|
@ -36,18 +36,18 @@ function remoterun(command, args) {
|
|
|
|
|
ssh.execCommand('/usr/bin/sudo -- ' + command, {cwd: config.infrastructure})
|
|
|
|
|
.then(function(result) {
|
|
|
|
|
if(result.code === 0) {
|
|
|
|
|
resolve(result)
|
|
|
|
|
resolve(result);
|
|
|
|
|
} else {
|
|
|
|
|
reject(result)
|
|
|
|
|
reject(result);
|
|
|
|
|
}
|
|
|
|
|
}, function(result) {
|
|
|
|
|
reject(result)
|
|
|
|
|
reject(result);
|
|
|
|
|
})
|
|
|
|
|
}, function(result) {
|
|
|
|
|
reject(result)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const commands = {};
|
|
|
|
@ -60,14 +60,14 @@ commands['rebuild'].exec = function(args, room, event) {
|
|
|
|
|
|
|
|
|
|
matrixclient.sendNotice(room.roomId, 'rebuilding container ' + container);
|
|
|
|
|
|
|
|
|
|
remoterun('./rebuild.sh ' + container)
|
|
|
|
|
remoterun('./rebuild.sh ' + container);
|
|
|
|
|
.then(function(result) {
|
|
|
|
|
matrixclient.sendNotice(room.roomId, event.sender.userId + '\nrebuilt container ' + container);
|
|
|
|
|
}, function(result) {
|
|
|
|
|
matrixclient.sendNotice(room.roomId, event.sender.userId + '\nrebuild of container ' + container + ' failed.\ncode: ' + result.code + '\nstdout: \n```\n' + result.stdout + '```\nstderr: \n```\n' + result.stderr + '\n```');
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
matrixclient.on('Room.timeline', function(event, room, resettimeline) {
|
|
|
|
|