Merge "use instance_id as string for plugin sections"

This commit is contained in:
Zuul 2023-10-16 14:05:01 +00:00 committed by Gerrit Code Review
commit 36ed936803
2 changed files with 8 additions and 4 deletions

View File

@ -39,7 +39,7 @@ class InitManager(object):
if not instance_id: if not instance_id:
return self._PLUGINS_CONFIG_SECTION return self._PLUGINS_CONFIG_SECTION
else: else:
return instance_id + "/" + self._PLUGINS_CONFIG_SECTION return ("%s/%s" % (instance_id, self._PLUGINS_CONFIG_SECTION))
def _get_plugin_status(self, osutils, instance_id, plugin_name): def _get_plugin_status(self, osutils, instance_id, plugin_name):
return osutils.get_config_value(plugin_name, return osutils.get_config_value(plugin_name,

View File

@ -60,14 +60,18 @@ class TestInitManager(unittest.TestCase):
if not instance_id: if not instance_id:
self.assertEqual(self._init._PLUGINS_CONFIG_SECTION, response) self.assertEqual(self._init._PLUGINS_CONFIG_SECTION, response)
else: else:
self.assertEqual( expected_response = (
instance_id + "/" + self._init._PLUGINS_CONFIG_SECTION, "%s/%s" % (instance_id, self._init._PLUGINS_CONFIG_SECTION))
response) self.assertEqual(expected_response, response)
def test_get_plugin_section_id(self): def test_get_plugin_section_id(self):
fake_id = "100" fake_id = "100"
self._test_get_plugin_section(instance_id=fake_id) self._test_get_plugin_section(instance_id=fake_id)
def test_get_plugin_section_id_int(self):
fake_id = 100
self._test_get_plugin_section(instance_id=fake_id)
def test_get_plugin_section_no_id(self): def test_get_plugin_section_no_id(self):
self._test_get_plugin_section(instance_id=None) self._test_get_plugin_section(instance_id=None)