testing
This commit is contained in:
parent
a756a79513
commit
6b955f4885
@ -8,9 +8,10 @@ var client = redis.createClient();
|
|||||||
var lxc = require('../lxc');
|
var lxc = require('../lxc');
|
||||||
|
|
||||||
router.get('/start/:name', function(req, res, next){
|
router.get('/start/:name', function(req, res, next){
|
||||||
lxc.start(req.params.name, function(status, message){
|
lxc.start(req.params.name, function(data){
|
||||||
|
console.log('start': data);
|
||||||
if(status){
|
if(status){
|
||||||
res.json({status: 500, name: req.params.name, message: message});
|
res.json({status: 500, name: req.params.name, message: data});
|
||||||
}else{
|
}else{
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
lxc.info(req.params.name, null, function(data){
|
lxc.info(req.params.name, null, function(data){
|
||||||
@ -32,12 +33,14 @@ router.get('/start/:name', function(req, res, next){
|
|||||||
|
|
||||||
router.get('/live/:template/:name', function(req, res, next){
|
router.get('/live/:template/:name', function(req, res, next){
|
||||||
lxc.startEphemeral(req.params.name, req.params.template, function (data) {
|
lxc.startEphemeral(req.params.name, req.params.template, function (data) {
|
||||||
|
console.log('live': data);
|
||||||
res.json(data);
|
res.json(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/stop/:name', function(req, res, next){
|
router.get('/stop/:name', function(req, res, next){
|
||||||
lxc.stop(req.params.name, function(data){
|
lxc.stop(req.params.name, function(data){
|
||||||
|
console.log('stop': data);
|
||||||
if(data){
|
if(data){
|
||||||
res.json({status: 500, name: req.params.name, message: data});
|
res.json({status: 500, name: req.params.name, message: data});
|
||||||
}else{
|
}else{
|
||||||
@ -48,6 +51,7 @@ router.get('/stop/:name', function(req, res, next){
|
|||||||
|
|
||||||
router.get('/clone/:template/:name', function(req, res, next){
|
router.get('/clone/:template/:name', function(req, res, next){
|
||||||
lxc.clone(req.params.name, req.params.template, function(data){
|
lxc.clone(req.params.name, req.params.template, function(data){
|
||||||
|
console.log('clone': data);
|
||||||
if( data.match(/Created container/) ){
|
if( data.match(/Created container/) ){
|
||||||
res.json({status: 200});
|
res.json({status: 200});
|
||||||
}else{
|
}else{
|
||||||
@ -58,6 +62,7 @@ router.get('/clone/:template/:name', function(req, res, next){
|
|||||||
|
|
||||||
router.get('/destroy/:name', function(req, res, next){
|
router.get('/destroy/:name', function(req, res, next){
|
||||||
lxc.destroy(req.params.name, function(data){
|
lxc.destroy(req.params.name, function(data){
|
||||||
|
console.log('destroy': data);
|
||||||
if(data){
|
if(data){
|
||||||
res.json({status: 500, message: data});
|
res.json({status: 500, message: data});
|
||||||
}else{
|
}else{
|
||||||
@ -68,12 +73,14 @@ router.get('/destroy/:name', function(req, res, next){
|
|||||||
|
|
||||||
router.get('/info/:name', function(req, res, next){
|
router.get('/info/:name', function(req, res, next){
|
||||||
lxc.info(req.params.name, function(data){
|
lxc.info(req.params.name, function(data){
|
||||||
|
console.log('info': data);
|
||||||
res.json(data);
|
res.json(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/list', function(req, res, next) {
|
router.get('/list', function(req, res, next) {
|
||||||
lxc.list(function(data){
|
lxc.list(function(data){
|
||||||
|
console.log('list': data);
|
||||||
res.json(data);
|
res.json(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user