summaryrefslogtreecommitdiff
path: root/cmd/podman/create.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-01-12 10:14:04 -0500
committerGitHub <noreply@github.com>2018-01-12 10:14:04 -0500
commit378bed4869dccc4a886a8888aa5cd7dc13cdaee2 (patch)
treea4e68c836c823308ffc40afbf8862072d16fbc98 /cmd/podman/create.go
parent77aa1bcaeda3411ec3117db1ede622480bf35642 (diff)
parentaf3df2842c22667edf903eb6b5e2e606538c850e (diff)
downloadpodman-378bed4869dccc4a886a8888aa5cd7dc13cdaee2.tar.gz
podman-378bed4869dccc4a886a8888aa5cd7dc13cdaee2.tar.bz2
podman-378bed4869dccc4a886a8888aa5cd7dc13cdaee2.zip
Merge pull request #213 from baude/unitTestsSpec
Test user input to spec
Diffstat (limited to 'cmd/podman/create.go')
-rw-r--r--cmd/podman/create.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index 076e8c56e..ead2f6735 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -160,13 +160,18 @@ func createCmd(c *cli.Context) error {
}
}
+ if len(c.Args()) < 1 {
+ return errors.Errorf("image name or ID is required")
+ }
+
runtime, err := getRuntime(c)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
}
defer runtime.Shutdown(false)
- createConfig, err := parseCreateOpts(c, runtime)
+ imageName, _, data, err := imageData(c, runtime, c.Args()[0])
+ createConfig, err := parseCreateOpts(c, runtime, imageName, data)
if err != nil {
return err
}
@@ -365,15 +370,13 @@ func imageData(c *cli.Context, runtime *libpod.Runtime, image string) (string, s
// Parses CLI options related to container creation into a config which can be
// parsed into an OCI runtime spec
-func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, error) {
+func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string, data *libpod.ImageData) (*createConfig, error) {
+ //imageName, imageID, data, err := imageData(c, runtime, image)
var command []string
var memoryLimit, memoryReservation, memorySwap, memoryKernel int64
var blkioWeight uint16
- if len(c.Args()) < 1 {
- return nil, errors.Errorf("image name or ID is required")
- }
- image := c.Args()[0]
+ imageID := data.ID
if len(c.Args()) > 1 {
command = c.Args()[1:]
@@ -460,10 +463,6 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er
}
shmDir = ctr.ShmDir()
}
- imageName, imageID, data, err := imageData(c, runtime, image)
- if err != nil {
- return nil, err
- }
// USER
user := c.String("user")