From 3c43e2f1b9b40102ac8ce8bcae8be77364ad0f50 Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 26 Feb 2018 04:49:21 -0500 Subject: [PATCH] RemoteResourceProfile now remote also resource (same for threshold and stats) --- apier/v1/resourcesv1.go | 8 ++++---- apier/v1/stats.go | 3 +++ apier/v1/thresholds.go | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apier/v1/resourcesv1.go b/apier/v1/resourcesv1.go index ff6d0f0f5..117f92c9d 100644 --- a/apier/v1/resourcesv1.go +++ b/apier/v1/resourcesv1.go @@ -94,10 +94,10 @@ func (apierV1 *ApierV1) RemResourceProfile(arg utils.TenantID, reply *string) er return utils.NewErrMandatoryIeMissing(missing...) } if err := apierV1.DataManager.RemoveResourceProfile(arg.Tenant, arg.ID, utils.NonTransactional, true); err != nil { - if err.Error() != utils.ErrNotFound.Error() { - err = utils.NewErrServerError(err) - } - return err + return utils.APIErrorHandler(err) + } + if err := apierV1.DataManager.RemoveResource(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { + return utils.APIErrorHandler(err) } *reply = utils.OK return nil diff --git a/apier/v1/stats.go b/apier/v1/stats.go index 1da79f301..12bf1aae9 100644 --- a/apier/v1/stats.go +++ b/apier/v1/stats.go @@ -68,6 +68,9 @@ func (apierV1 *ApierV1) RemStatQueueProfile(args *utils.TenantID, reply *string) if err := apierV1.DataManager.RemoveStatQueueProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } + if err := apierV1.DataManager.RemStatQueue(args.Tenant, args.ID, utils.NonTransactional); err != nil { + return utils.APIErrorHandler(err) + } *reply = utils.OK return nil } diff --git a/apier/v1/thresholds.go b/apier/v1/thresholds.go index 908ad4eda..659990068 100644 --- a/apier/v1/thresholds.go +++ b/apier/v1/thresholds.go @@ -94,6 +94,9 @@ func (apierV1 *ApierV1) RemThresholdProfile(args *utils.TenantID, reply *string) if err := apierV1.DataManager.RemoveThresholdProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } + if err := apierV1.DataManager.RemoveThreshold(args.Tenant, args.ID, utils.NonTransactional); err != nil { + return utils.APIErrorHandler(err) + } *reply = utils.OK return nil }