mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Verify tenant only if was populated for AgentRequest and EventExporterRequest
This commit is contained in:
committed by
Dan Christian Bogos
parent
1f3588fb65
commit
89f5332c7a
@@ -54,6 +54,7 @@ func NewAgentRequest(req utils.DataProvider,
|
||||
}
|
||||
ar = &AgentRequest{
|
||||
Request: req,
|
||||
Tenant: dfltTenant,
|
||||
Vars: vars,
|
||||
CGRRequest: utils.NewOrderedNavigableMap(),
|
||||
diamreq: utils.NewOrderedNavigableMap(), // special case when CGRateS is building the request
|
||||
@@ -65,13 +66,12 @@ func NewAgentRequest(req utils.DataProvider,
|
||||
Trailer: trailer,
|
||||
Opts: opts,
|
||||
}
|
||||
// populate tenant
|
||||
if tntIf, err := ar.ParseField(
|
||||
&config.FCTemplate{Type: utils.META_COMPOSED,
|
||||
Value: tntTpl}); err == nil && tntIf.(string) != "" {
|
||||
ar.Tenant = tntIf.(string)
|
||||
} else {
|
||||
ar.Tenant = dfltTenant
|
||||
if tntTpl != nil {
|
||||
if tntIf, err := ar.ParseField(
|
||||
&config.FCTemplate{Type: utils.META_COMPOSED,
|
||||
Value: tntTpl}); err == nil && tntIf.(string) != "" {
|
||||
ar.Tenant = tntIf.(string)
|
||||
}
|
||||
}
|
||||
ar.Vars.Set(utils.PathItems{{Field: utils.NodeID}}, utils.NewNMData(config.CgrConfig().GeneralCfg().NodeID))
|
||||
return
|
||||
|
||||
14
ees/eereq.go
14
ees/eereq.go
@@ -37,6 +37,7 @@ func NewEventExporterRequest(req utils.DataProvider, dc, opts utils.MapStorage,
|
||||
filterS *engine.FilterS) (eeR *EventExporterRequest) {
|
||||
eeR = &EventExporterRequest{
|
||||
req: req,
|
||||
tnt: dfltTenant,
|
||||
tmz: timezone,
|
||||
filterS: filterS,
|
||||
cnt: utils.NewOrderedNavigableMap(),
|
||||
@@ -45,13 +46,12 @@ func NewEventExporterRequest(req utils.DataProvider, dc, opts utils.MapStorage,
|
||||
dc: dc,
|
||||
opts: opts,
|
||||
}
|
||||
// populate tenant
|
||||
if tntIf, err := eeR.ParseField(
|
||||
&config.FCTemplate{Type: utils.META_COMPOSED,
|
||||
Value: tntTpl}); err == nil && tntIf.(string) != "" {
|
||||
eeR.tnt = tntIf.(string)
|
||||
} else {
|
||||
eeR.tnt = dfltTenant
|
||||
if tntTpl != nil {
|
||||
if tntIf, err := eeR.ParseField(
|
||||
&config.FCTemplate{Type: utils.META_COMPOSED,
|
||||
Value: tntTpl}); err == nil && tntIf.(string) != "" {
|
||||
eeR.tnt = tntIf.(string)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user