Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest how to disable weave errors and warnings #2990

Merged
merged 1 commit into from
Dec 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions common/weave/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *client) Status() (Status, error) {
req.Header.Add("Accept", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return Status{}, err
return Status{}, errorf("%v", err)
}
defer resp.Body.Close()

Expand Down Expand Up @@ -165,7 +165,7 @@ func (c *client) AddDNSEntry(fqdn, containerID string, ip net.IP) error {
req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode())))
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
return errorf("%v", err)
}
if err := resp.Body.Close(); err != nil {
return err
Expand Down Expand Up @@ -212,7 +212,7 @@ func (c *client) PS() (map[string]PSEntry, error) {
slurp, _ := ioutil.ReadAll(stdErr)
cmdErr := cmd.Wait()
if cmdErr != nil {
return nil, fmt.Errorf("%s: %q", cmdErr, slurp)
return nil, errorf("%s: %q", cmdErr, slurp)
}
if scannerErr != nil {
return nil, scannerErr
Expand All @@ -228,7 +228,7 @@ func (c *client) Expose() error {
if exitErr, ok := err.(*realexec.ExitError); ok {
stdErr = exitErr.Stderr
}
return fmt.Errorf("Error running weave ps: %s: %q", err, stdErr)
return errorf("Error running weave ps: %s: %q", err, stdErr)
}
ips := ipMatch.FindAllSubmatch(output, -1)
if ips != nil {
Expand All @@ -241,7 +241,7 @@ func (c *client) Expose() error {
if exitErr, ok := err.(*realexec.ExitError); ok {
stdErr = exitErr.Stderr
}
return fmt.Errorf("Error running weave expose: %s: %q", err, stdErr)
return errorf("Error running weave expose: %s: %q", err, stdErr)
}
return nil
}
Expand All @@ -251,3 +251,7 @@ func weaveCommand(arg ...string) exec.Cmd {
cmd.SetEnv(append(os.Environ(), "DOCKER_API_VERSION="+dockerAPIVersion))
return cmd
}

func errorf(format string, a ...interface{}) error {
return fmt.Errorf(format+". If you are not running Weave Net, you may wish to suppress this warning by launching scope with the `--weave=false` option.", a...)
}