From ca158f2da3c49ccea0c77ec0240ced44f0ec1d20 Mon Sep 17 00:00:00 2001 From: Rajesh Tailor Date: Mon, 15 Sep 2025 16:00:41 +0530 Subject: [PATCH] Fix string format specifier This change fixes string format specifier from $ to % for correct formatting. Closes-Bug: #2123840 Signed-off-by: Rajesh Tailor Change-Id: I04f6e1ba3eff443d40a13c6fe2d0b77a78a020e6 --- nova/exception.py | 2 +- nova/tests/functional/test_report_client.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nova/exception.py b/nova/exception.py index b7a01300c4..28cc7ace94 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -2245,7 +2245,7 @@ class PlacementReshapeConflict(PlacementAPIConflict): """ msg_fmt = _( "A conflict was encountered attempting to reshape a provider tree: " - "$(error)s" + "%(error)s" ) diff --git a/nova/tests/functional/test_report_client.py b/nova/tests/functional/test_report_client.py index a127072351..a3e81c7022 100644 --- a/nova/tests/functional/test_report_client.py +++ b/nova/tests/functional/test_report_client.py @@ -1569,13 +1569,17 @@ class SchedulerReportClientTests(test.TestCase): # So we expect that it is signalled with an exception so that the # upper layer can re-drive the reshape process with a fresh tree that # now has the inventories - self.assertRaises( + ex = self.assertRaises( exception.PlacementReshapeConflict, self.client.update_from_provider_tree, self.context, ptree, allocations=allocs, ) + ex_msg = str(ex) + self.assertNotIn('$', ex_msg) + self.assertIn("A conflict was encountered attempting to reshape " + "a provider tree", ex_msg) # also we except that the internal caches is cleared so that the # re-drive will have a chance to load fresh data from placement self.assertEqual(0, len(self.client._provider_tree.roots))