diff --git a/src/clmc-webservice/clmcservice/tests.py b/src/clmc-webservice/clmcservice/tests.py index c106dfa09bf257d18481deb826df3f4980b97974..c6b95ed1e1aff8e6ba9c9942678d48fd0e47402e 100644 --- a/src/clmc-webservice/clmcservice/tests.py +++ b/src/clmc-webservice/clmcservice/tests.py @@ -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() diff --git a/src/clmc-webservice/clmcservice/views.py b/src/clmc-webservice/clmcservice/views.py index 969d1748278493d0cbf8cfcf377f23646339ded5..14c7700d2a91e22e56d41be7c1fe98f143ec8956 100644 --- a/src/clmc-webservice/clmcservice/views.py +++ b/src/clmc-webservice/clmcservice/views.py @@ -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