summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cliconfig/config.go1
-rw-r--r--cmd/podman/cp.go27
-rw-r--r--cmd/podman/network_rm.go18
-rw-r--r--cmd/podman/sign.go32
4 files changed, 45 insertions, 33 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index bf88e853b..e0ce202cc 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -280,6 +280,7 @@ type NetworkListValues struct {
type NetworkRmValues struct {
PodmanCommand
+ Force bool
}
type NetworkInspectValues struct {
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/network_rm.go b/cmd/podman/network_rm.go
index 50bd48cea..41e5dbdab 100644
--- a/cmd/podman/network_rm.go
+++ b/cmd/podman/network_rm.go
@@ -3,10 +3,13 @@
package main
import (
+ "fmt"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -31,6 +34,8 @@ func init() {
networkrmCommand.Command = _networkrmCommand
networkrmCommand.SetHelpTemplate(HelpTemplate())
networkrmCommand.SetUsageTemplate(UsageTemplate())
+ flags := networkrmCommand.Flags()
+ flags.BoolVarP(&networkrmCommand.Force, "force", "f", false, "remove any containers using network")
}
func networkrmCmd(c *cliconfig.NetworkRmValues) error {
@@ -40,9 +45,18 @@ func networkrmCmd(c *cliconfig.NetworkRmValues) error {
if len(c.InputArgs) < 1 {
return errors.Errorf("at least one network name is required")
}
- runtime, err := adapter.GetRuntimeNoStore(getContext(), &c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
if err != nil {
return err
}
- return runtime.NetworkRemove(c)
+ deletes, rmErrors, lastErr := runtime.NetworkRemove(getContext(), c)
+ for _, d := range deletes {
+ fmt.Println(d)
+ }
+ // we only want to print errors if there is more
+ // than one
+ for network, removalErr := range rmErrors {
+ logrus.Errorf("unable to remove %q: %q", network, removalErr)
+ }
+ return lastErr
}
diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go
index 63ba9b904..79bc3f02b 100644
--- a/cmd/podman/sign.go
+++ b/cmd/podman/sign.go
@@ -14,6 +14,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/trust"
"github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
@@ -130,22 +131,33 @@ func signCmd(c *cliconfig.SignValues) error {
return errors.Wrapf(err, "error pulling image %s", signimage)
}
- registryInfo := trust.HaveMatchRegistry(rawSource.Reference().DockerReference().String(), registryConfigs)
- if registryInfo != nil {
+ if rootless.IsRootless() {
if sigStoreDir == "" {
- sigStoreDir = registryInfo.SigStoreStaging
+ runtimeConfig, err := runtime.GetConfig()
+ if err != nil {
+ return err
+ }
+
+ sigStoreDir = filepath.Join(filepath.Dir(runtimeConfig.StorageConfig.GraphRoot), "sigstore")
+ }
+ } else {
+ registryInfo := trust.HaveMatchRegistry(rawSource.Reference().DockerReference().String(), registryConfigs)
+ if registryInfo != nil {
if sigStoreDir == "" {
- sigStoreDir = registryInfo.SigStore
+ sigStoreDir = registryInfo.SigStoreStaging
+ if sigStoreDir == "" {
+ sigStoreDir = registryInfo.SigStore
+ }
+ }
+ sigStoreDir, err = isValidSigStoreDir(sigStoreDir)
+ if err != nil {
+ return errors.Wrapf(err, "invalid signature storage %s", sigStoreDir)
}
}
- sigStoreDir, err = isValidSigStoreDir(sigStoreDir)
- if err != nil {
- return errors.Wrapf(err, "invalid signature storage %s", sigStoreDir)
+ if sigStoreDir == "" {
+ sigStoreDir = SignatureStoreDir
}
}
- if sigStoreDir == "" {
- sigStoreDir = SignatureStoreDir
- }
repos, err := newImage.RepoDigests()
if err != nil {