)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"c6ec3a5ef893e22d62f2ee83c3c49fc04aca06dd","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"6862ec71_6da66e86","updated":"2024-05-16 09:11:32.000000000","message":"recheck i miss the decorator","commit_id":"deb0e990d7730eaadb2b31790152fae1be0c5465"},{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"e32c4a3d7d4bf53b5f87cf1b40052f679620f13c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"3fb7f333_a48628da","updated":"2024-05-20 09:18:04.000000000","message":"recheck post_failure","commit_id":"38bbc8f2d78eeb8e86d1252edb46e5756d0d5144"}],"manilaclient/osc/v2/share_networks.py":[{"author":{"_account_id":30407,"name":"haixin","email":"haixin_haixin@qq.com","username":"haixin"},"change_message_id":"7d1ff9f3652119e536cfb33368278609a0c217d9","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"94a31f65_be26043d","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"updated":"2024-05-28 09:43:14.000000000","message":"1: The find_resource function of oscutils supports name query natively.\n   in osc_lib/utils/__init__.py\n   def find_resource(manager, name_or_id, **kwargs):\n\n2: Or you can try using apiutils.find_resource()\n   in manilaclient/common/apiclient/utils.py\n   def find_resource(manager, name_or_id, **find_args):","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":30407,"name":"haixin","email":"haixin_haixin@qq.com","username":"haixin"},"change_message_id":"8659b909c4954b567455b4271394a4431c55c89d","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"787e79fc_3d357d08","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"0769250b_784a463a","updated":"2024-05-29 09:11:12.000000000","message":"i test this in my env, but i can\u0027t reproduce the bug. See my comments on the bug page for details.\n\nFrom the code logic of osc_lib:\nwe will excc line 241 in def find_resource(manager, name_or_id, **kwargs):\n\n    return manager.find(**kwargs)  # wargs[\u0027name\u0027] \u003d name_or_id\n    \nthen will exec function def find(self, **kwargs) in class ManagerWithFind(Manager):\nand then matches \u003d self.findall(**kwargs).\n\nfinally call share_client.share_networks.list().\nIn general, it\u0027s the same logic as the function you wrote here.\nSo, I guess there is a problem with the osc_lib package on your environment and you need to upgrade it?","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":30407,"name":"haixin","email":"haixin_haixin@qq.com","username":"haixin"},"change_message_id":"c4f6631faf25079446b88c144a5aed144c8df24b","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"c3259964_b0619d94","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"0daad9d6_f7b98132","updated":"2024-05-29 09:54:29.000000000","message":"The program will not normally go to case 5, because share_client.share_networks has a find function. Defined in the class ManagerWithFind. in case 4 will find this share network.\n\n    class ManagerWithFind(Manager):\n        \"\"\"Like a `Manager`, but with additional `find()`/`findall()` methods.\"\"\"\n        def find(self, **kwargs):\n            \"\"\"Find a single item with attributes matching ``**kwargs``.\n\n            This isn\u0027t very efficient: it loads the entire list then filters on\n            the Python side.\n            \"\"\"\n            matches \u003d self.findall(**kwargs)\n        \nfinally call share api to list share network with search_opts \u003d {\u0027all_tenants\u0027: 1}\n\n    def findall(self, **kwargs):\n        \"\"\"Find all items with attributes matching ``**kwargs``.\n\n        This isn\u0027t very efficient: it loads the entire list then filters on\n        the Python side.\n        \"\"\"\n        found \u003d []\n        searches \u003d list(kwargs.items())\n\n        search_opts \u003d {\u0027all_tenants\u0027: 1}\n        resources \u003d self.list(search_opts\u003dsearch_opts)\n\nI suggest you debug it to see exactly what went wrong, it shouldn\u0027t be a bug.","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"820954f5219ad19b9cf1cfcda0368d6ecf7424c1","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"0daad9d6_f7b98132","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"787e79fc_3d357d08","updated":"2024-05-29 09:27:37.000000000","message":"I get error, which raise at:\n    # Case 5: For client with no find function, list all resources and hope\n    # to find a matching name or ID.\n    count \u003d 0\n    for resource in manager.list():\n        if (\n            resource.get(\u0027id\u0027) \u003d\u003d name_or_id\n            or resource.get(\u0027name\u0027) \u003d\u003d name_or_id\n        ):\n            count +\u003d 1\n            _resource \u003d resource\n\nThis may be related to my old version of the share api.\nI use v3.0.1 of osc_lib and os-share-api-version 2.32","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"769de836206cbce6e8479dd4b09ef693f4ed746a","unresolved":false,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"40e7e8ec_ce4767e5","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"894e534c_19c370c8","updated":"2024-05-31 11:27:59.000000000","message":"Okey, we will fix this error in our version of manila. I close the mr","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"2cb83c1ca0349e9cb42de36d20b40d958ff12a84","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"0769250b_784a463a","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"94a31f65_be26043d","updated":"2024-05-29 08:15:25.000000000","message":"if first case I give error like in bug, which I report.\nIn second case I give: Policy doesn\u0027t allow share_network:get_all_share_networks to be performed. (HTTP 403) (Request-ID: req-98839af3-6d1c-41fb-8eff-047ae4ed7248)\nThat error raises in:\n        try:\n            return manager.find(human_id\u003dname_or_id, **find_args)\n        except exceptions.NotFound:\n            pass\n\nSo, only function, which I add can help me to find share network by name","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":30407,"name":"haixin","email":"haixin_haixin@qq.com","username":"haixin"},"change_message_id":"eca1c2db72a8955eb4b9df3f1bf3f46d8eba09eb","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"894e534c_19c370c8","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"9f7ff09e_a422f3aa","updated":"2024-05-30 02:04:06.000000000","message":"os-share-api-version 2.32 is Ocata version, here are some bug in\n manila/api/v2/share_networks.py def _get_share_networks():\n \n     def _get_share_networks(self, req, is_detail\u003dTrue):\n        \"\"\"Returns a list of share networks.\"\"\"\n        context \u003d req.environ[\u0027manila.context\u0027]\n        search_opts \u003d {}\n        search_opts.update(req.GET)\n\n        if (\u0027all_tenants\u0027 in search_opts or\n            (\u0027project_id\u0027 in search_opts and\n             search_opts[\u0027project_id\u0027] !\u003d context.project_id)):\n                policy.check_policy(context, RESOURCE_NAME,     # this line error\n                                    \u0027get_all_share_networks\u0027)\n        ...\n        \nthe function in master branch:\n\n        def _get_share_networks(self, req, is_detail\u003dTrue):\n        \"\"\"Returns a list of share networks.\"\"\"\n        context \u003d req.environ[\u0027manila.context\u0027]\n        search_opts \u003d {}\n        search_opts.update(req.GET)\n        filters \u003d {}\n\n        # if not context.is_admin, will ignore project_id and all_tenants here,\n        # in database will auto add context.project_id to search_opts.\n        if context.is_admin:\n            if \u0027project_id\u0027 in search_opts:\n                # if specified project_id, will not use all_tenants\n                filters[\u0027project_id\u0027] \u003d search_opts[\u0027project_id\u0027]\n            elif not utils.is_all_tenants(search_opts):\n                # if not specified project_id and all_tenants, will get\n                # share networks in admin project.\n                filters[\u0027project_id\u0027] \u003d context.project_id\n                \nI recommend you rewrite this function to the latest version of manila, of course, you can also follow this patch to fix the problem in your local environment.\n\nHowever, the current new version of manila does not have this problem. In other words, the new version of manila api is already compatible with all_tenants for non-admin users. So I don\u0027t recommend manilaclient to merge this change.","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"fd95648126f0d6b9b77bb2e6c132e0608a793213","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9f7ff09e_a422f3aa","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"b2e1ad74_51971008","updated":"2024-05-29 17:52:55.000000000","message":"I don\u0027t have enough permissions to execute this request with the {\u0027all_tenants\u0027: 1} option (it\u0027s only possible for cloud admins). My change will not affect users who have sufficient rights to execute such a request in any way, but it will help me.","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"},{"author":{"_account_id":37033,"name":"Morozov Aleksey","display_name":"Aleksey","email":"morozovalekseywot@gmail.com","username":"morozovalekseywot"},"change_message_id":"5ec9193fd149450ccba8f6e9be52e90c65ae1209","unresolved":true,"context_lines":[{"line_number":206,"context_line":"    def take_action(self, parsed_args):"},{"line_number":207,"context_line":"        share_client \u003d self.app.client_manager.share"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        share_network \u003d oscutils.find_resource("},{"line_number":210,"context_line":"            share_client.share_networks,"},{"line_number":211,"context_line":"            parsed_args.share_network)"},{"line_number":212,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"b2e1ad74_51971008","side":"PARENT","line":209,"range":{"start_line":209,"start_character":24,"end_line":209,"end_character":46},"in_reply_to":"c3259964_b0619d94","updated":"2024-05-29 10:27:15.000000000","message":"From share_client.share_networks.find I get following error:\ncode:\nshare_network \u003d share_client.share_networks.find(name\u003dparsed_args.share_network)\nerror:\nPolicy doesn\u0027t allow share_network:get_all_share_networks to be performed.\n\nWhat could be the reason  for such error?","commit_id":"56ba69448654bae9490eca97ec887e5030f597ab"}]}
