Skip to content

Commit 36ed936

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "use instance_id as string for plugin sections"
2 parents 983e148 + 86adb2c commit 36ed936

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cloudbaseinit/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _get_plugins_section(self, instance_id):
3939
if not instance_id:
4040
return self._PLUGINS_CONFIG_SECTION
4141
else:
42-
return instance_id + "/" + self._PLUGINS_CONFIG_SECTION
42+
return ("%s/%s" % (instance_id, self._PLUGINS_CONFIG_SECTION))
4343

4444
def _get_plugin_status(self, osutils, instance_id, plugin_name):
4545
return osutils.get_config_value(plugin_name,

cloudbaseinit/tests/test_init.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,18 @@ def _test_get_plugin_section(self, instance_id):
6060
if not instance_id:
6161
self.assertEqual(self._init._PLUGINS_CONFIG_SECTION, response)
6262
else:
63-
self.assertEqual(
64-
instance_id + "/" + self._init._PLUGINS_CONFIG_SECTION,
65-
response)
63+
expected_response = (
64+
"%s/%s" % (instance_id, self._init._PLUGINS_CONFIG_SECTION))
65+
self.assertEqual(expected_response, response)
6666

6767
def test_get_plugin_section_id(self):
6868
fake_id = "100"
6969
self._test_get_plugin_section(instance_id=fake_id)
7070

71+
def test_get_plugin_section_id_int(self):
72+
fake_id = 100
73+
self._test_get_plugin_section(instance_id=fake_id)
74+
7175
def test_get_plugin_section_no_id(self):
7276
self._test_get_plugin_section(instance_id=None)
7377

0 commit comments

Comments
 (0)