Skip to content

Commit

Permalink
Skip image_folder if no access
Browse files Browse the repository at this point in the history
To avoid instant return we should skip image folders which we have no access to and try others.

Signed-off-by: Petr Fedchenkov <[email protected]>
  • Loading branch information
giggsoff committed Jan 31, 2023
1 parent aa97164 commit 368d871
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/ycc_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
description:
- Folders to search images by its family besides from
- standard and target folders
- Skips folders that users do not have access to
type: list
required: false
image_id:
Expand Down Expand Up @@ -635,10 +636,12 @@ def _get_image_by_family(self):
).id
break
except _InactiveRpcError as err:
if (
err._state.code # pylint: disable=protected-access
is not StatusCode.NOT_FOUND
):
err_code = err.code()
# if PERMISSION_DENIED returned try other folders
if err_code == StatusCode.PERMISSION_DENIED:
self.warn(err.details())
pass
elif err_code != StatusCode.NOT_FOUND:
raise err
else:
raise ImageFamilyNotFound
Expand Down

0 comments on commit 368d871

Please sign in to comment.