Skip to content
Snippets Groups Projects
Commit c8c689b2 authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

Malformed flag is now also indicated in the response of an update of the...

Malformed flag is now also indicated in the response of an update of the configuration of the aggregator
parent 4ee9b567
No related branches found
No related tags found
No related merge requests found
......@@ -308,7 +308,8 @@ class TestAggregatorAPI(object):
# update the configuration of the aggregator while it is running
config_body = '{"aggregator_report_period": 15, "aggregator_database_name": "E2EMetrics", "aggregator_database_url": "http://172.50.231.51:8086"}'
output_body = {'aggregator_report_period': 15, 'aggregator_database_name': "E2EMetrics", 'aggregator_database_url': "http://172.50.231.51:8086"}
output_body = {'aggregator_report_period': 15, 'aggregator_database_name': "E2EMetrics", 'aggregator_database_url': "http://172.50.231.51:8086", 'malformed': True,
'comment': 'Aggregator is running in a malformed state - it uses an old version of the configuration. Please, restart it so that the updated configuration is used.'}
request = testing.DummyRequest()
request.body = config_body.encode(request.charset)
response = AggregatorConfig(request).put()
......@@ -338,7 +339,8 @@ class TestAggregatorAPI(object):
# update the configuration again while the aggregator is running
config_body = '{"aggregator_report_period": 30, "aggregator_database_name": "E2EMetrics", "aggregator_database_url": "http://172.50.231.51:8086"}'
output_body = {'aggregator_report_period': 30, 'aggregator_database_name': "E2EMetrics", 'aggregator_database_url': "http://172.50.231.51:8086"}
output_body = {'aggregator_report_period': 30, 'aggregator_database_name': "E2EMetrics", 'aggregator_database_url': "http://172.50.231.51:8086", 'malformed': True,
'comment': 'Aggregator is running in a malformed state - it uses an old version of the configuration. Please, restart it so that the updated configuration is used.'}
request = testing.DummyRequest()
request.body = config_body.encode(request.charset)
response = AggregatorConfig(request).put()
......
......@@ -74,7 +74,11 @@ class AggregatorConfig(object):
# if configuration is not already malformed, check whether the configuration is updated
if not self.request.registry.settings[MALFORMED_FLAG]:
self.request.registry.settings[MALFORMED_FLAG] = old_config != new_config and self.request.registry.settings[RUNNING_FLAG]
malformed = old_config != new_config and self.request.registry.settings[RUNNING_FLAG]
self.request.registry.settings[MALFORMED_FLAG] = malformed
if malformed:
new_config[MALFORMED_FLAG] = True
new_config[COMMENT_ATTRIBUTE] = COMMENT_VALUE
return new_config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment