Fixups for loader to work with dry_run when destinations file not provided, config fixups, doc fixups

This commit is contained in:
DanB
2014-01-13 20:24:36 +01:00
parent 993c5400aa
commit 9428ffa9c6
9 changed files with 26 additions and 23 deletions

View File

@@ -334,13 +334,15 @@ func (csvr *CSVReader) LoadDestinationRates() (err error) {
break
}
}
if !destinationExists {
if dbExists, err := csvr.dataStorage.ExistsData(DESTINATION_PREFIX, record[1]); err != nil {
var err error
if !destinationExists && csvr.dataStorage != nil {
if destinationExists, err = csvr.dataStorage.ExistsData(DESTINATION_PREFIX, record[1]); err != nil {
return err
} else if !dbExists {
return fmt.Errorf("Could not get destination for tag %v", record[1])
}
}
if !destinationExists {
return fmt.Errorf("Could not get destination for tag %v", record[1])
}
dr := &utils.TPDestinationRate{
DestinationRateId: tag,
DestinationRates: []*utils.DestinationRate{
@@ -417,13 +419,14 @@ func (csvr *CSVReader) LoadRatingProfiles() (err error) {
csvr.ratingProfiles[key] = rp
}
_, exists := csvr.ratingPlans[record[5]]
if !exists {
if dbExists, err := csvr.dataStorage.ExistsData(RATING_PLAN_PREFIX, record[5]); err != nil {
if !exists && csvr.dataStorage != nil {
if exists, err = csvr.dataStorage.ExistsData(RATING_PLAN_PREFIX, record[5]); err != nil {
return err
} else if !dbExists {
return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", record[5]))
}
}
if !exists {
return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", record[5]))
}
rpa := &RatingPlanActivation{
ActivationTime: at,
RatingPlanId: record[5],