|
|
@ -36,18 +36,18 @@ function remoterun(command, args) {
|
|
|
|
ssh.execCommand('/usr/bin/sudo -- ' + command, {cwd: config.infrastructure})
|
|
|
|
ssh.execCommand('/usr/bin/sudo -- ' + command, {cwd: config.infrastructure})
|
|
|
|
.then(function(result) {
|
|
|
|
.then(function(result) {
|
|
|
|
if(result.code === 0) {
|
|
|
|
if(result.code === 0) {
|
|
|
|
resolve(result)
|
|
|
|
resolve(result);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
reject(result)
|
|
|
|
reject(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, function(result) {
|
|
|
|
}, function(result) {
|
|
|
|
reject(result)
|
|
|
|
reject(result);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}, function(result) {
|
|
|
|
}, function(result) {
|
|
|
|
reject(result)
|
|
|
|
reject(result)
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const commands = {};
|
|
|
|
const commands = {};
|
|
|
@ -60,14 +60,14 @@ commands['rebuild'].exec = function(args, room, event) {
|
|
|
|
|
|
|
|
|
|
|
|
matrixclient.sendNotice(room.roomId, 'rebuilding container ' + container);
|
|
|
|
matrixclient.sendNotice(room.roomId, 'rebuilding container ' + container);
|
|
|
|
|
|
|
|
|
|
|
|
remoterun('./rebuild.sh ' + container)
|
|
|
|
remoterun('./rebuild.sh ' + container);
|
|
|
|
.then(function(result) {
|
|
|
|
.then(function(result) {
|
|
|
|
matrixclient.sendNotice(room.roomId, event.sender.userId + '\nrebuilt container ' + container);
|
|
|
|
matrixclient.sendNotice(room.roomId, event.sender.userId + '\nrebuilt container ' + container);
|
|
|
|
}, function(result) {
|
|
|
|
}, 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.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) {
|
|
|
|
matrixclient.on('Room.timeline', function(event, room, resettimeline) {
|
|
|
|