diff options
author | baude <bbaude@redhat.com> | 2018-12-11 13:44:55 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2018-12-12 12:53:09 -0600 |
commit | 06d763d964c16fe0f19cb04f4f28f8c0ab8980bc (patch) | |
tree | 84ca5108db9183f3c4d919620058863a58a589e6 /cmd/podman/pod_create.go | |
parent | 8645df84dbb21f5988b46e6646bb0dd04fdb2b51 (diff) | |
download | podman-06d763d964c16fe0f19cb04f4f28f8c0ab8980bc.tar.gz podman-06d763d964c16fe0f19cb04f4f28f8c0ab8980bc.tar.bz2 podman-06d763d964c16fe0f19cb04f4f28f8c0ab8980bc.zip |
Clean up some existing varlink endpoints
Going through and adding options (like tls-verify, signature option, etc)
to some varlink endpoints (like push/pull) many of which had not been
updated since their original authoring.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/pod_create.go')
-rw-r--r-- | cmd/podman/pod_create.go | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go index a3364ac4b..967ce7610 100644 --- a/cmd/podman/pod_create.go +++ b/cmd/podman/pod_create.go @@ -3,15 +3,12 @@ package main import ( "fmt" "os" - "strconv" "strings" "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/libpod/cmd/podman/shared" "github.com/containers/libpod/libpod" "github.com/containers/libpod/pkg/rootless" - "github.com/cri-o/ocicni/pkg/ocicni" - "github.com/docker/go-connections/nat" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -150,7 +147,7 @@ func podCreateCmd(c *cli.Context) error { } if len(c.StringSlice("publish")) > 0 { - portBindings, err := CreatePortBindings(c.StringSlice("publish")) + portBindings, err := shared.CreatePortBindings(c.StringSlice("publish")) if err != nil { return err } @@ -178,36 +175,3 @@ func podCreateCmd(c *cli.Context) error { return nil } - -// CreatePortBindings iterates ports mappings and exposed ports into a format CNI understands -func CreatePortBindings(ports []string) ([]ocicni.PortMapping, error) { - var portBindings []ocicni.PortMapping - // The conversion from []string to natBindings is temporary while mheon reworks the port - // deduplication code. Eventually that step will not be required. - _, natBindings, err := nat.ParsePortSpecs(ports) - if err != nil { - return nil, err - } - for containerPb, hostPb := range natBindings { - var pm ocicni.PortMapping - pm.ContainerPort = int32(containerPb.Int()) - for _, i := range hostPb { - var hostPort int - var err error - pm.HostIP = i.HostIP - if i.HostPort == "" { - hostPort = containerPb.Int() - } else { - hostPort, err = strconv.Atoi(i.HostPort) - if err != nil { - return nil, errors.Wrapf(err, "unable to convert host port to integer") - } - } - - pm.HostPort = int32(hostPort) - pm.Protocol = containerPb.Proto() - portBindings = append(portBindings, pm) - } - } - return portBindings, nil -} |