diff options
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/api')
-rwxr-xr-x | components/pm-subscription-handler/pmsh_service/mod/api/controller.py | 10 | ||||
-rw-r--r-- | components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/controller.py b/components/pm-subscription-handler/pmsh_service/mod/api/controller.py index 7f4f28f5..de3aa5f3 100755 --- a/components/pm-subscription-handler/pmsh_service/mod/api/controller.py +++ b/components/pm-subscription-handler/pmsh_service/mod/api/controller.py @@ -167,14 +167,16 @@ def delete_meas_group_by_name(subscription_name, measurement_group_name): logger.info(f'API call received to delete measurement group: {measurement_group_name}') try: measurement_group_administrative_status = \ - measurement_group_service.query_get_meas_group_admin_status(subscription_name, measurement_group_name) + measurement_group_service.query_get_meas_group_admin_status(subscription_name, + measurement_group_name) if measurement_group_administrative_status == AdministrativeState.LOCKED.value: - if measurement_group_service.query_to_delete_meas_group(subscription_name, measurement_group_name) == 1: + if measurement_group_service.query_to_delete_meas_group(subscription_name, + measurement_group_name) == 1: return None, HTTPStatus.NO_CONTENT else: logger.error(f'Measurement Group not found with name {measurement_group_name}') - return {'error': f'Measurement Group not found with name {measurement_group_name}'}, \ - HTTPStatus.NOT_FOUND.value + return {'error': f'Measurement Group not found with name ' + f'{measurement_group_name}'}, HTTPStatus.NOT_FOUND.value else: logger.error('Measurement Group was not deleted because the Administrative State ' f'was {measurement_group_administrative_status}') diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py b/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py index 998c0b19..b272e5b8 100644 --- a/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py +++ b/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py @@ -170,7 +170,8 @@ def query_to_delete_meas_group(subscription_name, measurement_group_name): int: Returns '1' if subscription exists and deleted successfully else '0' """ affected_rows = db.session.query(MeasurementGroupModel) \ - .filter_by(subscription_name=subscription_name, measurement_group_name=measurement_group_name).delete() + .filter_by(subscription_name=subscription_name, + measurement_group_name=measurement_group_name).delete() db.session.commit() return affected_rows |