1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 22:32:14 +00:00

Sync with libcompose

This commit is contained in:
Josh Curl
2016-05-23 17:21:28 -07:00
parent 448f12acb1
commit 42e48476e7
17 changed files with 278 additions and 182 deletions

View File

@@ -1,6 +1,7 @@
package docker
import (
composeConfig "github.com/docker/libcompose/config"
"github.com/docker/libcompose/docker"
"github.com/docker/libcompose/project"
"github.com/rancher/os/util"
@@ -11,13 +12,13 @@ type ServiceFactory struct {
Deps map[string][]string
}
func (s *ServiceFactory) Create(project *project.Project, name string, serviceConfig *project.ServiceConfig) (project.Service, error) {
if after := serviceConfig.Labels.MapParts()["io.rancher.os.after"]; after != "" {
func (s *ServiceFactory) Create(project *project.Project, name string, serviceConfig *composeConfig.ServiceConfig) (project.Service, error) {
if after := serviceConfig.Labels["io.rancher.os.after"]; after != "" {
for _, dep := range util.TrimSplit(after, ",") {
s.Deps[name] = append(s.Deps[name], dep)
}
}
if before := serviceConfig.Labels.MapParts()["io.rancher.os.before"]; before != "" {
if before := serviceConfig.Labels["io.rancher.os.before"]; before != "" {
for _, dep := range util.TrimSplit(before, ",") {
s.Deps[dep] = append(s.Deps[dep], name)
}