Skip to content

Commit

Permalink
Merge "use instance_id as string for plugin sections"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Oct 16, 2023
2 parents 983e148 + 86adb2c commit 36ed936
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cloudbaseinit/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _get_plugins_section(self, instance_id):
if not instance_id:
return self._PLUGINS_CONFIG_SECTION
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):
return osutils.get_config_value(plugin_name,
Expand Down
10 changes: 7 additions & 3 deletions cloudbaseinit/tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ def _test_get_plugin_section(self, instance_id):
if not instance_id:
self.assertEqual(self._init._PLUGINS_CONFIG_SECTION, response)
else:
self.assertEqual(
instance_id + "/" + self._init._PLUGINS_CONFIG_SECTION,
response)
expected_response = (
"%s/%s" % (instance_id, self._init._PLUGINS_CONFIG_SECTION))
self.assertEqual(expected_response, response)

def test_get_plugin_section_id(self):
fake_id = "100"
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):
self._test_get_plugin_section(instance_id=None)

Expand Down

0 comments on commit 36ed936

Please sign in to comment.