From f3d60676583b7d6a53099fb9ef346392bb25b592 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 7 Mar 2018 18:18:31 +0100 Subject: [PATCH] mgr/dashboard_v2: removed unused code that broke teuthology Signed-off-by: Sebastian Wagner --- .../test_cluster_configuration.py | 38 +++++-------------- .../controllers/cluster_configuration.py | 16 +------- 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/qa/tasks/mgr/dashboard_v2/test_cluster_configuration.py b/qa/tasks/mgr/dashboard_v2/test_cluster_configuration.py index a88915298cba9..6cfe605e9474d 100644 --- a/qa/tasks/mgr/dashboard_v2/test_cluster_configuration.py +++ b/qa/tasks/mgr/dashboard_v2/test_cluster_configuration.py @@ -10,37 +10,20 @@ class ClusterConfigurationTest(DashboardTestCase): self.assertStatus(200) self.assertIsInstance(data, list) self.assertGreater(len(data), 1000) - - # service filter - data = self._get('/api/cluster_conf?service=mds') - self.assertTrue(all('mds' in e['services'] for e in data)) - self.assertFalse(all('mon' in e['services'] for e in data)) - - # basic filter - data = self._get('/api/cluster_conf?level=basic') - self.assertTrue(all('basic' in e['level'] for e in data)) - - # advanced filter - data = self._get('/api/cluster_conf?level=advanced') - actual_levels = set([e['level'] for e in data]) - self.assertTrue({'advanced', 'basic'}.issubset(actual_levels)) - - # developer filter - data = self._get('/api/cluster_conf?level=developer') - actual_levels = set([e['level'] for e in data]) - self.assertTrue({'advanced', 'basic', - 'developer'}.issubset(actual_levels)) - - # two filters - data = self._get('/api/cluster_conf?level=advanced&service=mds') - actual_levels = set([e['level'] for e in data]) - self.assertTrue({'advanced', 'basic'}.issubset(actual_levels)) - self.assertTrue(all('mds' in e['services'] for e in data)) + for conf in data: + self._validate_single(conf) @authenticate def test_get(self): data = self._get('/api/cluster_conf/admin_socket') self.assertStatus(200) + self._validate_single(data) + self.assertIn('enum_values', data) + + data = self._get('/api/cluster_conf/fantasy_name') + self.assertStatus(404) + + def _validate_single(self, data): self.assertIn('name', data) self.assertIn('daemon_default', data) self.assertIn('long_desc', data) @@ -51,9 +34,6 @@ class ClusterConfigurationTest(DashboardTestCase): self.assertIn('min', data) self.assertIn('max', data) self.assertIn('services', data) - self.assertIn('enum_values', data) self.assertIn('type', data) self.assertIn('desc', data) - data = self._get('/api/cluster_conf/fantasy_name') - self.assertStatus(404) diff --git a/src/pybind/mgr/dashboard_v2/controllers/cluster_configuration.py b/src/pybind/mgr/dashboard_v2/controllers/cluster_configuration.py index 80d5909d73246..d02027b1c6568 100644 --- a/src/pybind/mgr/dashboard_v2/controllers/cluster_configuration.py +++ b/src/pybind/mgr/dashboard_v2/controllers/cluster_configuration.py @@ -10,22 +10,8 @@ from ..tools import ApiController, RESTController, AuthRequired @ApiController('cluster_conf') @AuthRequired() class ClusterConfiguration(RESTController): - def list(self, service=None, level=None): - levels = ['basic', 'advanced', 'developer'] - if level is not None: - assert level in levels - + def list(self): options = mgr.get("config_options")['options'] - - if service is not None: - options = [o for o in options if service in o['services']] - - if level is not None: - options = [ - o for o in options - if levels.index(o['level']) <= levels.index(level) - ] - return options def get(self, name): -- 2.39.5