move docker_tls_args into weaveutil

and also give users a clue what went wrong when docker isn't running
This commit is contained in:
Matthias Radestock committed 2016-01-02 14:00:44 +00:00
1 parent ec872d7b45
commit 4ebcd355f6
6 files changed
+18 -25

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ RUN apk add --update \
&& rm -rf /var/cache/apk/*
ADD ./weave ./sigproxy ./weaveproxy ./symlink /home/weave/
ADD ./weaveutil ./docker_tls_args /usr/bin/
ADD ./weaveutil /usr/bin/
ADD ./weavewait /w/w
ADD ./weavewait_noop /w-noop/w
ADD ./weavewait_nomcast /w-nomcast/w
@@ -13,14 +13,18 @@ import (
"strings"
)
func main() {
func dockerTLSArgs(args []string) error {
if len(args) > 0 {
cmdUsage("docker-tls-args", "")
}
procRoot := os.Getenv("PROCFS")
if procRoot == "" {
procRoot = "/proc"
}
dirEntries, err := ioutil.ReadDir(procRoot)
checkErr(err)
if err != nil {
return err
}
for _, dirEntry := range dirEntries {
dirName := dirEntry.Name()
@@ -63,15 +67,8 @@ func main() {
}
fmt.Println(strings.Join(tlsArgs, " "))
os.Exit(0)
return nil
}
os.Exit(1)
}
func checkErr(err error) {
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
return fmt.Errorf("cannot locate running docker daemon")
}
+3 -2
View File
@@ -10,8 +10,9 @@ var commands map[string]func([]string) error
func init() {
commands = map[string]func([]string) error{
"help": help,
"netcheck": netcheck,
"help": help,
"netcheck": netcheck,
"docker-tls-args": dockerTLSArgs,
}
}