summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cp.go23
-rw-r--r--cmd/podman/inspect.go8
-rw-r--r--cmd/podman/main_local.go14
3 files changed, 28 insertions, 17 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index 6c5e4ee43..9d00dbe59 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -327,20 +327,6 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
}
return nil
}
- if !archive.IsArchivePath(srcPath) {
- // This srcPath is a file, and either it's not an
- // archive, or we don't care whether or not it's an
- // archive.
- destfi, err := os.Stat(destPath)
- if err != nil {
- if !os.IsNotExist(err) {
- return errors.Wrapf(err, "failed to get stat of dest path %s", destPath)
- }
- }
- if destfi != nil && destfi.IsDir() {
- destPath = filepath.Join(destPath, filepath.Base(srcPath))
- }
- }
if extract {
// We're extracting an archive into the destination directory.
@@ -351,9 +337,16 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
return nil
}
- if destDirIsExist || strings.HasSuffix(dest, string(os.PathSeparator)) {
+ destfi, err := os.Stat(destPath)
+ if err != nil {
+ if !os.IsNotExist(err) {
+ return errors.Wrapf(err, "failed to get stat of dest path %s", destPath)
+ }
+ }
+ if destfi != nil && destfi.IsDir() {
destPath = filepath.Join(destPath, filepath.Base(srcPath))
}
+
// Copy the file, preserving attributes.
logrus.Debugf("copying %q to %q", srcPath, destPath)
if err = copyFileWithTar(srcPath, destPath); err != nil {
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index 4303c149c..24edfcb68 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -98,6 +98,14 @@ func inspectCmd(c *cliconfig.InspectValues) error {
if strings.Contains(outputFormat, "{{.Id}}") {
outputFormat = strings.Replace(outputFormat, "{{.Id}}", formats.IDString, -1)
}
+ // These fields were renamed, so we need to provide backward compat for
+ // the old names.
+ if strings.Contains(outputFormat, ".Src") {
+ outputFormat = strings.Replace(outputFormat, ".Src", ".Source", -1)
+ }
+ if strings.Contains(outputFormat, ".Dst") {
+ outputFormat = strings.Replace(outputFormat, ".Dst", ".Destination", -1)
+ }
if latestContainer {
lc, err := runtime.GetLatestContainer()
if err != nil {
diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go
index 132f35ab5..7a062cb4b 100644
--- a/cmd/podman/main_local.go
+++ b/cmd/podman/main_local.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
+ "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/tracing"
"github.com/containers/libpod/pkg/util"
@@ -25,8 +26,17 @@ import (
const remote = false
func init() {
-
- rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.CGroupManager, "cgroup-manager", "", "Cgroup manager to use (cgroupfs or systemd, default systemd)")
+ cgroupManager := libpod.SystemdCgroupsManager
+ if runtimeConfig, err := libpod.DefaultRuntimeConfig(); err == nil {
+ cgroupManager = runtimeConfig.CgroupManager
+ }
+ cgroupHelp := "Cgroup manager to use (cgroupfs or systemd)"
+ cgroupv2, _ := util.IsCgroup2UnifiedMode()
+ if rootless.IsRootless() && !cgroupv2 {
+ cgroupManager = ""
+ cgroupHelp = "Cgroup manager is not supported in rootless mode"
+ }
+ rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.CGroupManager, "cgroup-manager", cgroupManager, cgroupHelp)
// -c is deprecated due to conflict with -c on subcommands
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.CpuProfile, "cpu-profile", "", "Path for the cpu profiling results")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.Config, "config", "", "Path of a libpod config file detailing container server configuration options")