)]}'
{"swift/cli/relinker.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"ea34408941ab943a40a458d92e2d24936af490c7","unresolved":true,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"def policy(policy_name_or_index):"},{"line_number":42,"context_line":"    if isinstance(policy_name_or_index, str):"},{"line_number":43,"context_line":"        value \u003d POLICIES.get_by_name(policy_name_or_index)"},{"line_number":44,"context_line":"        if value:"},{"line_number":45,"context_line":"            return value"}],"source_content_type":"text/x-python","patch_set":1,"id":"2589f54e_2c594fea","line":42,"updated":"2021-03-22 09:17:06.000000000","message":"args values are always strings, so this could give a false match if a policy name happens to be a number\n\ne.g. add StoragePolicy(2, name\u003d\u00270\u0027) to the unit test patch_policies\n\ncrazy I know but AFAICT not disallowed.\n\nThe only safe way out of this would be to try lookup by name and by index, and if you have two results, bail out in despair. Makes me wonder if it is worth adding a method to StoragePolicyCollection to lookup by name or index??","commit_id":"e3c84fb9257436c6af5c544a26b0a0527652db5a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"8f16f3b7c60d900f224c38a797963ae86e196dfa","unresolved":true,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"def policy(policy_name_or_index):"},{"line_number":42,"context_line":"    if isinstance(policy_name_or_index, str):"},{"line_number":43,"context_line":"        value \u003d POLICIES.get_by_name(policy_name_or_index)"},{"line_number":44,"context_line":"        if value:"},{"line_number":45,"context_line":"            return value"}],"source_content_type":"text/x-python","patch_set":1,"id":"58aebdbe_dfa37f88","line":42,"in_reply_to":"2589f54e_2c594fea","updated":"2021-03-22 17:37:10.000000000","message":"Good point -- for some reason I thought https://github.com/openstack/swift/blob/2.27.0/swift/common/storage_policy.py#L298-L321 was more defensive than it is; I was expecting requirements similar to what Python uses for variable names, where you can have numbers in the name but it can\u0027t *start* with a number...","commit_id":"e3c84fb9257436c6af5c544a26b0a0527652db5a"}],"swift/common/storage_policy.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"8ecc2009d6e225f0db6c37d0bb881c8284a98f71","unresolved":true,"context_lines":[{"line_number":826,"context_line":"            raise PolicyError("},{"line_number":827,"context_line":"                \"Found different polices when searching by \""},{"line_number":828,"context_line":"                \"name (%s) and by index (%s)\" % (by_name, by_index))"},{"line_number":829,"context_line":"        return by_name or by_index"},{"line_number":830,"context_line":""},{"line_number":831,"context_line":"    @property"},{"line_number":832,"context_line":"    def legacy(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"04c93e78_0321f1b3","line":829,"updated":"2021-03-25 10:25:05.000000000","message":"ok. I don\u0027t think we can introduce a restriction on policy names going forwards without breaking any existing configs, so this is the best we can do.\n\nPolicy names can be changed so I guess we could , if motivated, flag warnings when loading policies that number names are deprecated and will eventually be disallowed.\n\nFor now, I\u0027ll add something to the docs.","commit_id":"047eb37193d5628c420c7dd0322dfac0cd7ced5f"}],"test/unit/cli/test_relinker.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"9550ca55427e24334092f54f38653ca052ccfcb8","unresolved":true,"context_lines":[{"line_number":640,"context_line":"        self.logger.clear()"},{"line_number":641,"context_line":"        with mock.patch.object(relinker.logging, \u0027getLogger\u0027,"},{"line_number":642,"context_line":"                               return_value\u003dself.logger):"},{"line_number":643,"context_line":"            self.assertEqual(0, relinker.main(["},{"line_number":644,"context_line":"                \u0027relink\u0027,"},{"line_number":645,"context_line":"                \u0027--swift-dir\u0027, self.testdir,"},{"line_number":646,"context_line":"                \u0027--policy\u0027, \u0027gold\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"361534a4_a312fabe","line":643,"updated":"2021-03-22 05:18:03.000000000","message":"why did you remove the assertEqual for the other two reliner.main calls. But have it here?","commit_id":"e3c84fb9257436c6af5c544a26b0a0527652db5a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"8f16f3b7c60d900f224c38a797963ae86e196dfa","unresolved":true,"context_lines":[{"line_number":640,"context_line":"        self.logger.clear()"},{"line_number":641,"context_line":"        with mock.patch.object(relinker.logging, \u0027getLogger\u0027,"},{"line_number":642,"context_line":"                               return_value\u003dself.logger):"},{"line_number":643,"context_line":"            self.assertEqual(0, relinker.main(["},{"line_number":644,"context_line":"                \u0027relink\u0027,"},{"line_number":645,"context_line":"                \u0027--swift-dir\u0027, self.testdir,"},{"line_number":646,"context_line":"                \u0027--policy\u0027, \u0027gold\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"bf328922_0cf2d42b","line":643,"in_reply_to":"361534a4_a312fabe","updated":"2021-03-22 17:37:10.000000000","message":"The other two are in\n\n with self.assertRaises(SystemExit) as cm:\n\nblocks; the assertion was never actually tested.","commit_id":"e3c84fb9257436c6af5c544a26b0a0527652db5a"}]}
