fix(coreos-cloudinit): Ensure /etc/coreos exists before writing to it
This commit is contained in:
parent
b87a4628e6
commit
cb4d9e81a4
@ -20,6 +20,9 @@ func addStrategy(strategy string, root string) error {
|
|||||||
etcUpdate := path.Join(root, "etc", "coreos", "update.conf")
|
etcUpdate := path.Join(root, "etc", "coreos", "update.conf")
|
||||||
usrUpdate := path.Join(root, "usr", "share", "coreos", "update.conf")
|
usrUpdate := path.Join(root, "usr", "share", "coreos", "update.conf")
|
||||||
|
|
||||||
|
// Ensure /etc/coreos/ exists before attempting to write a file in it
|
||||||
|
os.MkdirAll(path.Join(root, "etc", "coreos"), 0755)
|
||||||
|
|
||||||
tmp, err := ioutil.TempFile(path.Join(root, "etc", "coreos"), ".update.conf")
|
tmp, err := ioutil.TempFile(path.Join(root, "etc", "coreos"), ".update.conf")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -22,7 +22,6 @@ REBOOT_STRATEGY=etcd-lock
|
|||||||
|
|
||||||
func setupFixtures(dir string) {
|
func setupFixtures(dir string) {
|
||||||
os.MkdirAll(path.Join(dir, "usr", "share", "coreos"), 0755)
|
os.MkdirAll(path.Join(dir, "usr", "share", "coreos"), 0755)
|
||||||
os.MkdirAll(path.Join(dir, "etc", "coreos"), 0755)
|
|
||||||
os.MkdirAll(path.Join(dir, "run", "systemd", "system"), 0755)
|
os.MkdirAll(path.Join(dir, "run", "systemd", "system"), 0755)
|
||||||
|
|
||||||
ioutil.WriteFile(path.Join(dir, "usr", "share", "coreos", "update.conf"), []byte(base), 0644)
|
ioutil.WriteFile(path.Join(dir, "usr", "share", "coreos", "update.conf"), []byte(base), 0644)
|
||||||
|
Loading…
Reference in New Issue
Block a user