Skip to content

Commit

Permalink
cloudinit.GenerateLocalData: use new RemoveFilesIfExist semantics
Browse files Browse the repository at this point in the history
Simplify GenerateLocalData and do not ignore an error if we fail to ensure that any of files is gone.

Signed-off-by: Dan Kenigsberg <[email protected]>
  • Loading branch information
dankenigsberg committed Jan 30, 2021
1 parent 71c921c commit a21a109
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cloud-init/cloud-init.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,10 @@ func GenerateLocalData(vmiName string, namespace string, data *CloudInitData) er
networkData = []byte(data.NetworkData)
}

diskutils.RemoveFilesIfExist(userFile)
diskutils.RemoveFilesIfExist(metaFile)
diskutils.RemoveFilesIfExist(networkFile)
diskutils.RemoveFilesIfExist(isoStaging)
err = diskutils.RemoveFilesIfExist(userFile, metaFile, networkFile, isoStaging)
if err != nil {
return err
}

err = ioutil.WriteFile(userFile, userData, 0644)
if err != nil {
Expand Down

0 comments on commit a21a109

Please sign in to comment.