summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers_prune.go4
-rw-r--r--cmd/podman/cp.go27
-rw-r--r--cmd/podman/main.go8
-rw-r--r--cmd/podman/pause.go4
-rw-r--r--cmd/podman/restart.go4
-rw-r--r--cmd/podman/unpause.go4
6 files changed, 19 insertions, 32 deletions
diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go
index b8a84a0e3..3d0fef37d 100644
--- a/cmd/podman/containers_prune.go
+++ b/cmd/podman/containers_prune.go
@@ -53,7 +53,7 @@ func pruneContainersCmd(c *cliconfig.PruneContainersValues) error {
if err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
} else {
exitCode = 1
}
@@ -61,7 +61,7 @@ func pruneContainersCmd(c *cliconfig.PruneContainersValues) error {
return err
}
if len(failures) > 0 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
}
return printCmdResults(ok, failures)
}
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index 5e1ca8312..661d0a530 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -52,7 +52,7 @@ func init() {
cpCommand.Command = _cpCommand
flags := cpCommand.Flags()
flags.BoolVar(&cpCommand.Extract, "extract", false, "Extract the tar file into the destination directory.")
- flags.BoolVar(&cpCommand.Pause, "pause", false, "Pause the container while copying")
+ flags.BoolVar(&cpCommand.Pause, "pause", true, "Pause the container while copying")
cpCommand.SetHelpTemplate(HelpTemplate())
cpCommand.SetUsageTemplate(UsageTemplate())
}
@@ -147,7 +147,6 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
hostOwner := idtools.IDPair{UID: int(hostUID), GID: int(hostGID)}
- var glob []string
if isFromHostToCtr {
if isVol, volDestName, volName := isVolumeDestName(destPath, ctr); isVol {
path, err := pathWithVolumeMount(ctr, runtime, volDestName, volName, destPath)
@@ -209,13 +208,7 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
srcPath = cleanedPath
}
}
- glob, err = filepath.Glob(srcPath)
- if err != nil {
- return errors.Wrapf(err, "invalid glob %q", srcPath)
- }
- if len(glob) == 0 {
- glob = append(glob, srcPath)
- }
+
if !filepath.IsAbs(destPath) {
dir, err := os.Getwd()
if err != nil {
@@ -224,19 +217,11 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
destPath = filepath.Join(dir, destPath)
}
- var lastError error
- for _, src := range glob {
- if src == "-" {
- src = os.Stdin.Name()
- extract = true
- }
- err := copy(src, destPath, dest, idMappingOpts, &destOwner, extract, isFromHostToCtr)
- if lastError != nil {
- logrus.Error(lastError)
- }
- lastError = err
+ if src == "-" {
+ srcPath = os.Stdin.Name()
+ extract = true
}
- return lastError
+ return copy(srcPath, destPath, dest, idMappingOpts, &destOwner, extract, isFromHostToCtr)
}
func getUser(mountPoint string, userspec string) (specs.User, error) {
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 2b808b2bc..b83ccd9a5 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
_ "github.com/containers/libpod/pkg/hooks/0.1.0"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/version"
@@ -20,7 +21,7 @@ import (
// This is populated by the Makefile from the VERSION file
// in the repository
var (
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
Ctx context.Context
span opentracing.Span
closer io.Closer
@@ -152,11 +153,12 @@ func main() {
if err := rootCmd.Execute(); err != nil {
outputError(err)
} else {
- // The exitCode modified from 125, indicates an application
+ // The exitCode modified from define.ExecErrorCodeGeneric,
+ // indicates an application
// running inside of a container failed, as opposed to the
// podman command failed. Must exit with that exit code
// otherwise command exited correctly.
- if exitCode == 125 {
+ if exitCode == define.ExecErrorCodeGeneric {
exitCode = 0
}
diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go
index 3a8f4edb5..247a480e3 100644
--- a/cmd/podman/pause.go
+++ b/cmd/podman/pause.go
@@ -56,7 +56,7 @@ func pauseCmd(c *cliconfig.PauseValues) error {
if err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
} else {
exitCode = 1
}
@@ -64,7 +64,7 @@ func pauseCmd(c *cliconfig.PauseValues) error {
return err
}
if len(failures) > 0 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
}
return printCmdResults(ok, failures)
}
diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go
index 494a9ec06..c97fb0dc1 100644
--- a/cmd/podman/restart.go
+++ b/cmd/podman/restart.go
@@ -61,7 +61,7 @@ func restartCmd(c *cliconfig.RestartValues) error {
if err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
} else {
exitCode = 1
}
@@ -69,7 +69,7 @@ func restartCmd(c *cliconfig.RestartValues) error {
return err
}
if len(failures) > 0 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
}
return printCmdResults(ok, failures)
}
diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go
index 382b64e97..ae24b0e66 100644
--- a/cmd/podman/unpause.go
+++ b/cmd/podman/unpause.go
@@ -55,7 +55,7 @@ func unpauseCmd(c *cliconfig.UnpauseValues) error {
if err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
} else {
exitCode = 1
}
@@ -63,7 +63,7 @@ func unpauseCmd(c *cliconfig.UnpauseValues) error {
return err
}
if len(failures) > 0 {
- exitCode = 125
+ exitCode = define.ExecErrorCodeGeneric
}
return printCmdResults(ok, failures)
}