You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
const remoteExec = require('./remoteExec.js');
|
|
|
|
|
|
|
|
// links lubiland and module.exports
|
|
|
|
const lubiland = module.exports = {};
|
|
|
|
|
|
|
|
lubiland['infrastructure'] = {};
|
|
|
|
|
|
|
|
lubiland['infrastructure']['rebuild'] = {};
|
|
|
|
lubiland['infrastructure']['rebuild'].regex = /^([a-zA-Z0-9\-\_]*)$/;
|
|
|
|
lubiland['infrastructure']['rebuild'].usage = '<container>';
|
|
|
|
lubiland['infrastructure']['rebuild'].exec = (args) => {
|
|
|
|
const container = args[1];
|
|
|
|
|
|
|
|
matrixClient.sendNotice(room.roomId, 'rebuilding container ' + container);
|
|
|
|
|
|
|
|
remoteExec('./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```');
|
|
|
|
});
|
|
|
|
};
|