mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Replace FileStore() for CleanUp() in the Alertmanager interface (#77126)
Alerting: Remplace FileStore() for CleanUp() in the Alertmanager interface
This commit is contained in:
@@ -403,8 +403,9 @@ func (am *alertmanager) OrgID() int64 {
|
||||
return am.orgID
|
||||
}
|
||||
|
||||
func (am *alertmanager) FileStore() *FileStore {
|
||||
return am.fileStore
|
||||
// CleanUp removes the directory containing the alertmanager files from disk.
|
||||
func (am *alertmanager) CleanUp() {
|
||||
am.fileStore.CleanUp()
|
||||
}
|
||||
|
||||
// AlertValidationError is the error capturing the validation errors
|
||||
|
||||
@@ -54,9 +54,9 @@ type Alertmanager interface {
|
||||
TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*TestTemplatesResults, error)
|
||||
|
||||
// State
|
||||
CleanUp()
|
||||
StopAndWait()
|
||||
Ready() bool
|
||||
FileStore() *FileStore
|
||||
OrgID() int64
|
||||
ConfigHash() [16]byte
|
||||
}
|
||||
@@ -314,8 +314,8 @@ func (moa *MultiOrgAlertmanager) SyncAlertmanagersForOrgs(ctx context.Context, o
|
||||
moa.logger.Info("Stopping Alertmanager", "org", orgID)
|
||||
am.StopAndWait()
|
||||
moa.logger.Info("Stopped Alertmanager", "org", orgID)
|
||||
// Cleanup all the remaining resources from this alertmanager.
|
||||
am.FileStore().CleanUp()
|
||||
// Clean up all the remaining resources from this alertmanager.
|
||||
am.CleanUp()
|
||||
}
|
||||
|
||||
// We look for orphan directories and remove them. Orphan directories can
|
||||
@@ -350,7 +350,7 @@ func (moa *MultiOrgAlertmanager) cleanupOrphanLocalOrgState(ctx context.Context,
|
||||
moa.logger.Info("Found orphan organization directory", "orgID", orgID)
|
||||
workingDirPath := filepath.Join(dataDir, strconv.FormatInt(orgID, 10))
|
||||
fileStore := NewFileStore(orgID, moa.kvStore, workingDirPath)
|
||||
// Cleanup all the remaining resources from this alertmanager.
|
||||
// Clean up all the remaining resources from this alertmanager.
|
||||
fileStore.CleanUp()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,9 +294,8 @@ func (am *Alertmanager) Ready() bool {
|
||||
return am.ready
|
||||
}
|
||||
|
||||
func (am *Alertmanager) FileStore() *notifier.FileStore {
|
||||
return ¬ifier.FileStore{}
|
||||
}
|
||||
// We don't have files on disk, no-op.
|
||||
func (am *Alertmanager) CleanUp() {}
|
||||
|
||||
func (am *Alertmanager) OrgID() int64 {
|
||||
return am.orgID
|
||||
|
||||
Reference in New Issue
Block a user