Don't use drivers to store temporary image downloads

Upstream-commit: 948bb29d27dc7e367cd27003c059d83301b15c4f
Component: engine
This commit is contained in:
Solomon Hykes
2013-11-09 00:53:58 +00:00
parent 82d35959fb
commit 7c76e102e9

View File

@ -185,18 +185,9 @@ func (graph *Graph) TempLayerArchive(id string, compression archive.Compression,
// Mktemp creates a temporary sub-directory inside the graph's filesystem.
func (graph *Graph) Mktemp(id string) (string, error) {
if id == "" {
id = GenerateID()
}
// FIXME: use a separate "tmp" driver instead of the regular driver,
// to allow for removal at cleanup.
// Right now temp directories are never removed!
if err := graph.driver.Create(id, ""); err != nil {
return "", fmt.Errorf("Driver %s couldn't create temporary directory %s: %s", graph.driver, id, err)
}
dir, err := graph.driver.Get(id)
if err != nil {
return "", fmt.Errorf("Driver %s couldn't get temporary directory %s: %s", graph.driver, id, err)
dir := path.Join(graph.Root, "_tmp", GenerateID())
if err := os.MkdirAll(dir, 0700); err != nil {
return "", err
}
return dir, nil
}