mirror of
https://github.com/containers/podman.git
synced 2025-09-23 13:13:42 +08:00
Merge pull request #10723 from rhatdan/tmpdir
fix systemcontext to use correct TMPDIR
This commit is contained in:
4
vendor/github.com/containers/common/libimage/download.go
generated
vendored
4
vendor/github.com/containers/common/libimage/download.go
generated
vendored
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// tmpdir returns a path to a temporary directory.
|
||||
func (r *Runtime) tmpdir() string {
|
||||
func tmpdir() string {
|
||||
tmpdir := os.Getenv("TMPDIR")
|
||||
if tmpdir == "" {
|
||||
tmpdir = "/var/tmp"
|
||||
@ -25,7 +25,7 @@ func (r *Runtime) tmpdir() string {
|
||||
func (r *Runtime) downloadFromURL(source string) (string, error) {
|
||||
fmt.Printf("Downloading from %q\n", source)
|
||||
|
||||
outFile, err := ioutil.TempFile(r.tmpdir(), "import")
|
||||
outFile, err := ioutil.TempFile(r.systemContext.BigFilesTemporaryDir, "import")
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error creating file")
|
||||
}
|
||||
|
16
vendor/github.com/containers/common/libimage/image.go
generated
vendored
16
vendor/github.com/containers/common/libimage/image.go
generated
vendored
@ -329,17 +329,19 @@ func (i *Image) remove(ctx context.Context, rmMap map[string]*RemoveImageReport,
|
||||
// an `rmi foo` will not untag "foo" but instead attempt to remove the
|
||||
// entire image. If there's a container using "foo", we should get an
|
||||
// error.
|
||||
if options.Force || referencedBy == "" || numNames == 1 {
|
||||
if referencedBy == "" || numNames == 1 {
|
||||
// DO NOTHING, the image will be removed
|
||||
} else {
|
||||
byID := strings.HasPrefix(i.ID(), referencedBy)
|
||||
byDigest := strings.HasPrefix(referencedBy, "sha256:")
|
||||
if byID && numNames > 1 {
|
||||
return errors.Errorf("unable to delete image %q by ID with more than one tag (%s): please force removal", i.ID(), i.Names())
|
||||
} else if byDigest && numNames > 1 {
|
||||
// FIXME - Docker will remove the digest but containers storage
|
||||
// does not support that yet, so our hands are tied.
|
||||
return errors.Errorf("unable to delete image %q by digest with more than one tag (%s): please force removal", i.ID(), i.Names())
|
||||
if !options.Force {
|
||||
if byID && numNames > 1 {
|
||||
return errors.Errorf("unable to delete image %q by ID with more than one tag (%s): please force removal", i.ID(), i.Names())
|
||||
} else if byDigest && numNames > 1 {
|
||||
// FIXME - Docker will remove the digest but containers storage
|
||||
// does not support that yet, so our hands are tied.
|
||||
return errors.Errorf("unable to delete image %q by digest with more than one tag (%s): please force removal", i.ID(), i.Names())
|
||||
}
|
||||
}
|
||||
|
||||
// Only try to untag if we know it's not an ID or digest.
|
||||
|
3
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
3
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
@ -84,6 +84,9 @@ func RuntimeFromStore(store storage.Store, options *RuntimeOptions) (*Runtime, e
|
||||
} else {
|
||||
systemContext = types.SystemContext{}
|
||||
}
|
||||
if systemContext.BigFilesTemporaryDir == "" {
|
||||
systemContext.BigFilesTemporaryDir = tmpdir()
|
||||
}
|
||||
|
||||
setRegistriesConfPath(&systemContext)
|
||||
|
||||
|
2
vendor/github.com/containers/common/version/version.go
generated
vendored
2
vendor/github.com/containers/common/version/version.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
// Version is the version of the build.
|
||||
const Version = "0.40.0"
|
||||
const Version = "0.40.1-dev"
|
||||
|
Reference in New Issue
Block a user