From 94a810751539afeb1590ccc1a9745f1d5767fda2 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 19 Dec 2017 09:07:49 -0500 Subject: Add support for adding devices to container Also add --quiet option to kpod create/run since this will help with writing tests. Signed-off-by: Daniel J Walsh Closes: #140 Approved by: TomSweeneyRedHat --- cmd/podman/create.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'cmd/podman/create.go') diff --git a/cmd/podman/create.go b/cmd/podman/create.go index f65bc49c6..79f08220d 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "fmt" + "io" "os" "strconv" "strings" @@ -14,7 +15,6 @@ import ( "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" - pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" ) type mountType string @@ -72,7 +72,7 @@ type createConfig struct { CgroupParent string // cgroup-parent Command []string Detach bool // detach - Devices []*pb.Device // device + Devices []string // device DNSOpt []string //dns-opt DNSSearch []string //dns-search DNSServers []string //dns @@ -101,6 +101,7 @@ type createConfig struct { Privileged bool //privileged Publish []string //publish PublishAll bool //publish-all + Quiet bool //quiet ReadOnlyRootfs bool //read-only Resources createResourceConfig Rm bool //rm @@ -167,8 +168,11 @@ func createCmd(c *cli.Context) error { if createImage.LocalName == "" { // The image wasnt found by the user input'd name or its fqname // Pull the image - fmt.Printf("Trying to pull %s...", createImage.PullName) - createImage.Pull() + var writer io.Writer + if !createConfig.Quiet { + writer = os.Stdout + } + createImage.Pull(writer) } runtimeSpec, err := createConfigToOCISpec(createConfig) @@ -419,6 +423,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er CgroupParent: c.String("cgroup-parent"), Command: command, Detach: c.Bool("detach"), + Devices: c.StringSlice("device"), DNSOpt: c.StringSlice("dns-opt"), DNSSearch: c.StringSlice("dns-search"), DNSServers: c.StringSlice("dns"), @@ -447,6 +452,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er Privileged: c.Bool("privileged"), Publish: c.StringSlice("publish"), PublishAll: c.Bool("publish-all"), + Quiet: c.Bool("quiet"), ReadOnlyRootfs: c.Bool("read-only"), Resources: createResourceConfig{ BlkioWeight: blkioWeight, -- cgit v1.2.3-54-g00ecf