* Includes updates to the out-of-tree patches. OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=13
59 lines
2.1 KiB
Diff
59 lines
2.1 KiB
Diff
From 0ec0bb380fd395b57eb613eeca537899ef9e49e2 Mon Sep 17 00:00:00 2001
|
|
From: Aleksa Sarai <asarai@suse.de>
|
|
Date: Fri, 1 Apr 2016 22:09:02 +1100
|
|
Subject: [PATCH 3/3] ctr: support proto://address format for --address
|
|
|
|
In order to match the containerd --listen update, allow users to set any
|
|
address of the form proto://address.
|
|
|
|
Signed-off-by: Aleksa Sarai <asarai@suse.de>
|
|
---
|
|
ctr/container.go | 11 +++++++++--
|
|
ctr/main.go | 4 ++--
|
|
2 files changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
Index: containerd-0.2.2/ctr/container.go
|
|
===================================================================
|
|
--- containerd-0.2.2.orig/ctr/container.go
|
|
+++ containerd-0.2.2/ctr/container.go
|
|
@@ -26,15 +26,22 @@ import (
|
|
|
|
// TODO: parse flags and pass opts
|
|
func getClient(ctx *cli.Context) types.APIClient {
|
|
+ // Parse proto://address form addresses.
|
|
+ bindSpec := ctx.GlobalString("address")
|
|
+ bindParts := strings.SplitN(bindSpec, "://", 2)
|
|
+ if len(bindParts) != 2 {
|
|
+ fatal(fmt.Sprintf("bad bind address format %s, expected proto://address", bindSpec), 1)
|
|
+ }
|
|
+
|
|
// reset the logger for grpc to log to dev/null so that it does not mess with our stdio
|
|
grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags))
|
|
dialOpts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithTimeout(ctx.GlobalDuration("conn-timeout"))}
|
|
dialOpts = append(dialOpts,
|
|
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
|
- return net.DialTimeout("unix", addr, timeout)
|
|
+ return net.DialTimeout(bindParts[0], bindParts[1], timeout)
|
|
},
|
|
))
|
|
- conn, err := grpc.Dial(ctx.GlobalString("address"), dialOpts...)
|
|
+ conn, err := grpc.Dial(bindSpec, dialOpts...)
|
|
if err != nil {
|
|
fatal(err.Error(), 1)
|
|
}
|
|
Index: containerd-0.2.2/ctr/main.go
|
|
===================================================================
|
|
--- containerd-0.2.2.orig/ctr/main.go
|
|
+++ containerd-0.2.2/ctr/main.go
|
|
@@ -41,8 +41,8 @@ func main() {
|
|
},
|
|
cli.StringFlag{
|
|
Name: "address",
|
|
- Value: "/run/containerd/containerd.sock",
|
|
- Usage: "address of GRPC API",
|
|
+ Value: "unix:///run/containerd/containerd.sock",
|
|
+ Usage: "proto://address of GRPC API",
|
|
},
|
|
cli.DurationFlag{
|
|
Name: "conn-timeout",
|