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>
(cherry picked from commit 0f22d7e295)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
This commit is contained in:
Daniel Hiltgen 2018-09-20 18:00:46 -07:00
parent b7ec4a42d9
commit ab6c0e1845
1 changed files with 2 additions and 0 deletions

View File

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