diff --git a/src/service/clmcservice/alertsapi/views.py b/src/service/clmcservice/alertsapi/views.py index 71a2a771efdfffa2a84ec9dc11479bf4343de6c3..8ce0f83f03b0dc09d51b2053147c64787d616afd 100644 --- a/src/service/clmcservice/alertsapi/views.py +++ b/src/service/clmcservice/alertsapi/views.py @@ -419,6 +419,8 @@ class AlertsConfigurationAPI(object): if patch_duplicates and get(kapacitor_api_tasks_instance_url).status_code == 200: # this will only happen if the patch_duplicates flag is set to True delete(kapacitor_api_tasks_instance_url) + # an alternative is to use the PATCH API endpoint instead of deleting and creating it again, however, + # using the PATCH method requires the task to be disabled and re-enabled for changes to take effect (more HTTP requests) response = post(kapacitor_api_tasks_url, json=kapacitor_http_request_body) response_content = response.json() capture_error = response_content.get("error", "") != "" @@ -482,8 +484,6 @@ class AlertsConfigurationAPI(object): if patch_duplicates and get(kapacitor_api_handlers_instance_url).status_code == 200: # this will only happen if the patch_duplicates flag is set to True delete(kapacitor_api_handlers_instance_url) - # an alternative is to use the PATCH API endpoint instead of deleting and creating it again, however, - # using the PATCH method requires the task to be disabled and re-enabled for changes to take effect (more HTTP requests) response = post(kapacitor_api_handlers_url, json=kapacitor_http_request_body) response_content = response.json() capture_error = response_content.get("error", "") != "" @@ -515,7 +515,7 @@ class AlertsConfigurationAPI(object): alerts_input_file = alert_spec_reference.file # allow only .yaml and .yml extensions for filename - if not (alerts_input_filename.lower().endswith('.yaml') or alerts_input_filename.lower.endswith('.yml')): + if not (alerts_input_filename.lower().endswith('.yaml') and not alerts_input_filename.lower().endswith('.yml')): raise HTTPBadRequest("Request to this API endpoint must include a (YAML) file input referenced as 'alert-spec' representing the TOSCA Alerts Specification.") # parse the alerts specification file diff --git a/src/test/clmctest/alerts/test_alerts.py b/src/test/clmctest/alerts/test_alerts.py index 808ab2535ef1f7b9ddba8e7b9b9ebde4f66dc932..60c0d598ff13c486dc71e2bc4c5216a9ece8ddaa 100644 --- a/src/test/clmctest/alerts/test_alerts.py +++ b/src/test/clmctest/alerts/test_alerts.py @@ -182,7 +182,7 @@ class TestAlerts(object): alert_logs = listdir(LOG_TEST_FOLDER_PATH) assert len(alert_logs) == 4, "4 log files must have been created - one for each alert defined in the specification." - # check the content of eac log file + # check the content of each log file for alert_log in alert_logs: alert_log_path = join(LOG_TEST_FOLDER_PATH, alert_log)