mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix bug not creating filepath for silences/nflog if it does not exist (#39174)
We created this filepath just as we're about persist the templates - with the latest change, we now need to create it sooner.
This commit is contained in:
@@ -93,6 +93,12 @@ func (fs *FileStore) IsExists(fn string) bool {
|
||||
|
||||
// WriteFileToDisk writes a file with the provided name and contents to the Alertmanager working directory with the default grafana permission.
|
||||
func (fs *FileStore) WriteFileToDisk(fn string, content []byte) error {
|
||||
// Ensure the working directory is created
|
||||
err := os.MkdirAll(fs.workingDirPath, 0750)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create the working directory %q: %s", fs.workingDirPath, err)
|
||||
}
|
||||
|
||||
return os.WriteFile(fs.pathFor(fn), content, 0644)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user