Remove metadata file before writing

The packages will deliver this as a link so lets make sure we don't
write through the link to the underlying packaged file.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
Upstream-commit: 0f22d7e295
Component: cli
This commit is contained in:
Daniel Hiltgen
2018-09-20 18:00:46 -07:00
parent e5e1355bb7
commit f074e8a141

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -124,6 +125,7 @@ func (c *baseClient) WriteRuntimeMetadata(dockerRoot string, metadata *RuntimeMe
return err
}
os.Remove(filename)
return ioutil.WriteFile(filename, data, 0644)
}