Add in remaing places infrastructure for ActionProfile

This commit is contained in:
TeoV
2020-12-04 13:36:57 +02:00
committed by Dan Christian Bogos
parent 77712ef776
commit f19a78538a
4 changed files with 101 additions and 0 deletions

View File

@@ -698,6 +698,8 @@ func (ms *MongoStorage) GetKeysForPrefix(prefix string) (result []string, err er
result, err = ms.getField3(sctx, ColIndx, utils.ActionPlanIndexes, "key")
case utils.ActionProfilesFilterIndexPrfx:
result, err = ms.getField3(sctx, ColIndx, utils.ActionProfilesFilterIndexPrfx, "key")
case utils.RateProfilesFilterIndexPrfx:
result, err = ms.getField3(sctx, ColIndx, utils.RateProfilesFilterIndexPrfx, "key")
case utils.RateFilterIndexPrfx:
result, err = ms.getField3(sctx, ColIndx, utils.RateFilterIndexPrfx, "key")
case utils.FilterIndexPrfx:

View File

@@ -332,6 +332,18 @@ func (self *TPExporter) Run() error {
}
}
storDataActionProfiles, err := self.storDb.GetTPActionProfiles(self.tpID, "", "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
utils.Logger.Warning(fmt.Sprintf("<%s> error: %s, when getting %s from stordb for export", utils.ApierS, err, utils.TpRateProfiles))
withError = true
}
for _, sd := range storDataActionProfiles {
sdModels := APItoModelTPActionProfile(sd)
for _, sdModel := range sdModels {
toExportMap[utils.ActionProfilesCsv] = append(toExportMap[utils.ActionProfilesCsv], sdModel)
}
}
if len(toExportMap) == 0 { // if we don't have anything to export we return not found error
return utils.ErrNotFound
}

View File

@@ -2563,6 +2563,7 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]i
utils.ChargerProfileIDs: chargerIDs,
utils.DispatcherProfileIDs: dppIDs,
utils.DispatcherHostIDs: dphIDs,
utils.RateProfileIDs: ratePrfIDs,
utils.ActionProfileIDs: actionPrfIDs,
},
}