Add missing ServiceManager methods

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-01-29 11:47:41 +00:00
parent 1bf5eeb046
commit 8315413046
No known key found for this signature in database
GPG Key ID: 49690ED87032539F

View File

@ -226,6 +226,15 @@ export class ServiceManager extends (EventEmitter as {
}
}
}
public getAllByAppId(appId: number) {
return this.getAll(`app-id=${appId}`);
}
public async stopAllByAppId(appId: number) {
for (const app of await this.getAllByAppId(appId)) {
await this.kill(app, { removeContainer: false });
}
}
public async create(service: Service) {
const mockContainerId = this.config.newUniqueKey();