Merge pull request #881 from balena-io/fix-service-manager

Add missing ServiceManager methods
This commit is contained in:
CameronDiver 2019-01-29 12:32:25 +00:00 committed by GitHub
commit f738416242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();