mirror of
https://github.com/rancher/os.git
synced 2025-08-16 05:54:51 +00:00
commit
e81cfe9217
12
Godeps/Godeps.json
generated
12
Godeps/Godeps.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"ImportPath": "github.com/rancherio/os",
|
||||
"GoVersion": "go1.4.1",
|
||||
"GoVersion": "go1.4.2",
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "github.com/Sirupsen/logrus",
|
||||
@ -142,7 +142,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/docker/machine/utils",
|
||||
"Comment": "v0.1.0-rc3-18-gd674e87",
|
||||
"Comment": "v0.1.0-rc4",
|
||||
"Rev": "d674e87813ffc10048f55d884396be1af327705e"
|
||||
},
|
||||
{
|
||||
@ -172,13 +172,13 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/rancherio/rancher-compose/librcompose/docker",
|
||||
"Comment": "0.1.0-25-g22c2b87",
|
||||
"Rev": "22c2b870151ab3fa7f3727cfc4504e326ea512e1"
|
||||
"Comment": "0.1.0-27-g1be3efa",
|
||||
"Rev": "1be3efa22d0bbae71d1aed14fcdb870dd0706f1c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/rancherio/rancher-compose/librcompose/project",
|
||||
"Comment": "0.1.0-25-g22c2b87",
|
||||
"Rev": "22c2b870151ab3fa7f3727cfc4504e326ea512e1"
|
||||
"Comment": "0.1.0-27-g1be3efa",
|
||||
"Rev": "1be3efa22d0bbae71d1aed14fcdb870dd0706f1c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ryanuber/go-glob",
|
||||
|
31
Godeps/_workspace/src/github.com/rancherio/rancher-compose/librcompose/docker/convert.go
generated
vendored
31
Godeps/_workspace/src/github.com/rancherio/rancher-compose/librcompose/docker/convert.go
generated
vendored
@ -10,10 +10,30 @@ import (
|
||||
shlex "github.com/flynn/go-shlex"
|
||||
)
|
||||
|
||||
func Filter(vs []string, f func(string) bool) []string {
|
||||
r := make([]string, 0, len(vs))
|
||||
for _, v := range vs {
|
||||
if f(v) {
|
||||
r = append(r, v)
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func isBind(s string) bool {
|
||||
return strings.ContainsRune(s, ':')
|
||||
}
|
||||
|
||||
func isVolume(s string) bool {
|
||||
return !isBind(s)
|
||||
}
|
||||
|
||||
func Convert(c *project.ServiceConfig) (*runconfig.Config, *runconfig.HostConfig, error) {
|
||||
volumes := map[string]struct{}{}
|
||||
for _, v := range c.Volumes {
|
||||
volumes[strings.Split(v, ":")[0]] = struct{}{}
|
||||
vs := Filter(c.Volumes, isVolume)
|
||||
|
||||
volumes := make(map[string]struct {}, len(vs))
|
||||
for _, v := range vs {
|
||||
volumes[v] = struct {}{}
|
||||
}
|
||||
|
||||
cmd, _ := shlex.Split(c.Command)
|
||||
@ -51,6 +71,7 @@ func Convert(c *project.ServiceConfig) (*runconfig.Config, *runconfig.HostConfig
|
||||
Tty: c.Tty,
|
||||
OpenStdin: c.StdinOpen,
|
||||
WorkingDir: c.WorkingDir,
|
||||
Volumes: volumes,
|
||||
}
|
||||
host_config := &runconfig.HostConfig{
|
||||
VolumesFrom: c.VolumesFrom,
|
||||
@ -58,10 +79,10 @@ func Convert(c *project.ServiceConfig) (*runconfig.Config, *runconfig.HostConfig
|
||||
CapDrop: c.CapDrop,
|
||||
CpuShares: c.CpuShares,
|
||||
Privileged: c.Privileged,
|
||||
Binds: c.Volumes,
|
||||
Binds: Filter(c.Volumes, isBind),
|
||||
Dns: dns,
|
||||
DnsSearch: dnssearch,
|
||||
LogConfig: runconfig.LogConfig{
|
||||
LogConfig: runconfig.LogConfig{
|
||||
Type: c.LogDriver,
|
||||
},
|
||||
Memory: c.MemLimit,
|
||||
|
Loading…
Reference in New Issue
Block a user