Upgrade libkermit/compose version

This commit is contained in:
NicoMen 2017-09-06 15:02:03 +02:00 committed by Traefiker
parent 9ce4f94818
commit 2b863d9bc2
3 changed files with 26 additions and 10 deletions

4
glide.lock generated
View file

@ -1,4 +1,4 @@
hash: fd8e1bbabefc71e0fc1551dcf67688d0b5ad1f23168a5c0256b8c98dda1b1fb3
hash: 5e9aeda91bffc11f916ff6c324b26a02a279ed1d691e7a783ca03dfab584083c
updated: 2017-08-25T11:52:16.848940186+02:00
imports:
- name: cloud.google.com/go
@ -783,7 +783,7 @@ testImports:
- name: github.com/gorilla/mux
version: e444e69cbd2e2e3e0749a2f3c717cec491552bbf
- name: github.com/libkermit/compose
version: 2048f803f56422a65b455f918d4a61704dc94603
version: 6167fd37267d2dfbcbcbee0a321adaa9531f4062
subpackages:
- check
- name: github.com/libkermit/docker

View file

@ -210,7 +210,7 @@ testImport:
- package: github.com/go-check/check
version: 11d3bc7aa68e238947792f30573146a3231fc0f1
- package: github.com/libkermit/compose
version: 2048f803f56422a65b455f918d4a61704dc94603
version: 6167fd37267d2dfbcbcbee0a321adaa9531f4062
subpackages:
- check
- package: github.com/libkermit/docker

View file

@ -75,13 +75,20 @@ func CreateProject(name string, composeFiles ...string) (*Project, error) {
}
// Start creates and starts the compose project.
func (p *Project) Start() error {
func (p *Project) Start(services ...string) error {
ctx := context.Background()
err := p.composeProject.Create(ctx, options.Create{})
if err != nil {
return err
}
err = p.composeProject.Start(ctx)
return p.StartOnly(services...)
}
// StartOnly only starts created services which are stopped.
func (p *Project) StartOnly(services ...string) error {
ctx := context.Background()
err := p.composeProject.Start(ctx, services...)
if err != nil {
return err
}
@ -91,18 +98,27 @@ func (p *Project) Start() error {
return nil
}
// Stop shuts down and clean the project
func (p *Project) Stop() error {
// FIXME(vdemeester) handle timeout
// StopOnly only stop services without delete them.
func (p *Project) StopOnly(services ...string) error {
ctx := context.Background()
err := p.composeProject.Stop(ctx, 10)
err := p.composeProject.Stop(ctx, 10, services...)
if err != nil {
return err
}
<-p.stopped
close(p.stopped)
return nil
}
err = p.composeProject.Delete(ctx, options.Delete{})
// Stop shuts down and clean the project
func (p *Project) Stop(services ...string) error {
// FIXME(vdemeester) handle timeout
err := p.StopOnly(services...)
if err != nil {
return err
}
ctx := context.Background()
err = p.composeProject.Delete(ctx, options.Delete{}, services...)
if err != nil {
return err
}