mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 23:30:05 +02:00
fix(portal-data): infer container id from machine_id (they are not the same)
This commit is contained in:
parent
b3581a61d2
commit
a2e0100f5e
@ -1002,7 +1002,7 @@ module.exports = class Data extends EventEmitter {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
container.stop(next);
|
||||
});
|
||||
},
|
||||
@ -1038,7 +1038,7 @@ module.exports = class Data extends EventEmitter {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
container.start(next);
|
||||
});
|
||||
},
|
||||
@ -1074,7 +1074,7 @@ module.exports = class Data extends EventEmitter {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
container.restart(next);
|
||||
});
|
||||
},
|
||||
@ -1112,7 +1112,7 @@ module.exports = class Data extends EventEmitter {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
// Use force in case the container is running. TODO: should we keep force?
|
||||
container.remove({ force: true }, next);
|
||||
});
|
||||
@ -1220,7 +1220,7 @@ module.exports = class Data extends EventEmitter {
|
||||
|
||||
VAsync.forEachParallel({
|
||||
func: (instance, next) => {
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
container.stop(next);
|
||||
},
|
||||
inputs: instances
|
||||
@ -1246,7 +1246,7 @@ module.exports = class Data extends EventEmitter {
|
||||
|
||||
VAsync.forEachParallel({
|
||||
func: (instance, next) => {
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
container.start((err) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@ -1286,7 +1286,7 @@ module.exports = class Data extends EventEmitter {
|
||||
VAsync.forEachParallel({
|
||||
func: (instance, next) => {
|
||||
this.updateInstance({ id: instance.id, status: 'RESTARTING' }, () => {
|
||||
const container = this._docker.getContainer(instance.machine_id);
|
||||
const container = this._docker.getContainer(instance.machine_id.split(/\-/)[0]);
|
||||
container.restart(next);
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user