Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[27.x backport] cli-plugins: Fix searching inaccessible directories #5652

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

vvoland
Copy link
Collaborator

@vvoland vvoland commented Nov 28, 2024

Fix a case where one inaccessible plugin search path stops the whole search and prevents latter paths from being scanned.

Remove a preliminary Stat call that verifies whether path is an actual directory and is accessible.
It's unneeded and doesn't actually check whether the directory can be listed or not.
os.ReadDir will fail in such case anyway, so just attempt to do that and ignore any encountered error, instead of erroring out the whole plugin candidate listing.

- What I did

- How I did it

- How to verify it
TestListPluginCandidatesInaccesibleDir

- Description for the changelog

Fix inaccessible plugins paths preventing plugins from being detected.

- A picture of a cute animal (not mandatory but encouraged)

Fix a case where one inaccessible plugin search path stops the whole
search and prevents latter paths from being scanned.

Remove a preliminary `Stat` call that verifies whether path is an actual
directory and is accessible.
It's unneeded and doesn't actually check whether the directory can be
listed or not.
`os.ReadDir` will fail in such case anyway, so just attempt to do that
and ignore any encountered error, instead of erroring out the whole
plugin candidate listing.

Signed-off-by: Paweł Gronowski <[email protected]>
(cherry picked from commit 6de3d71)
Signed-off-by: Paweł Gronowski <[email protected]>
The returned error is always nil now, so just remove it.

Signed-off-by: Paweł Gronowski <[email protected]>
(cherry picked from commit fcd94fe)
Signed-off-by: Paweł Gronowski <[email protected]>
@vvoland vvoland added this to the 27.4.0 milestone Nov 28, 2024
@vvoland vvoland self-assigned this Nov 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.57%. Comparing base (47a4f70) to head (790d09e).
Report is 9 commits behind head on 27.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             27.x    #5652      +/-   ##
==========================================
+ Coverage   58.54%   58.57%   +0.03%     
==========================================
  Files         346      346              
  Lines       29335    29323      -12     
==========================================
+ Hits        17173    17175       +2     
+ Misses      11184    11174      -10     
+ Partials      978      974       -4     

@thaJeztah thaJeztah marked this pull request as ready for review November 29, 2024 14:25
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 9ea09fd into docker:27.x Nov 29, 2024
102 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants