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

Added logic to allow {dot} files on startup #1437

Merged
merged 3 commits into from
Nov 4, 2021

Conversation

ryanbogan
Copy link
Member

Signed-off-by: Ryan Bogan [email protected]

Description

Fixes a bug that would not allow OpenSearch to run when a {dot} file (i.e. ".test") was present in the plugins folder.

Issues Resolved

#626

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@opensearch-ci-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 9165c4cbde3910754983d277541484b5cb90fa32

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 9165c4cbde3910754983d277541484b5cb90fa32

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 9165c4cbde3910754983d277541484b5cb90fa32

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

So, we have findPluginDirs that returns the list of plugin directories. Today it also returns a bunch of files that start with . and this PR attempts to filter it. This is difficult to grok and even more difficult to test.

Instead, consider modifying findPluginDirs to only return the plugin directories we care about, and write a test for it.

We also likely want to warn when we encounter something that's not a plugin in the plugins directory.

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 9165c4cbde3910754983d277541484b5cb90fa32

@opensearch-ci-bot
Copy link
Collaborator

❌   DCO Check Failed 9165c4cbde3910754983d277541484b5cb90fa32
Run ./dev-tools/signoff-check.sh remotes/origin/main 9165c4cbde3910754983d277541484b5cb90fa32 to check locally
Use git commit with -s to add 'Signed-of-by: {EMAIL}' on impacted commits

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 9165c4cbde3910754983d277541484b5cb90fa32

@ryanbogan
Copy link
Member Author

I'll modify findPluginDirs to only return the plugins that are directories and return a warning each time a {dot} file is encountered.

@nknize
Copy link
Collaborator

nknize commented Oct 26, 2021

hi @ryanbogan can you rebase your PR w/ latest main branch? The DCO check wasn't your fault. A dirty commit made it into main and this has since been corrected.

@opensearch-ci-bot
Copy link
Collaborator

❌   DCO Check Failed 2b1822c4e1859fb2d507e866d97858239cf79a3a
Run ./dev-tools/signoff-check.sh remotes/origin/main 2b1822c4e1859fb2d507e866d97858239cf79a3a to check locally
Use git commit with -s to add 'Signed-of-by: {EMAIL}' on impacted commits

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 2b1822c4e1859fb2d507e866d97858239cf79a3a

@ryanbogan
Copy link
Member Author

I rebased but it still failed the DCO check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 2b1822c4e1859fb2d507e866d97858239cf79a3a

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 885936329d5f438985de395882de1d6df4752114

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 885936329d5f438985de395882de1d6df4752114

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 885936329d5f438985de395882de1d6df4752114

@ryanbogan ryanbogan requested a review from dblock October 27, 2021 18:37
@VachaShah
Copy link
Collaborator

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 885936329d5f438985de395882de1d6df4752114
Log 832

Reports 832

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

This needs tests for all those added scenarios, like the specific file name(s), and logger.warn.

|| plugin.getFileName().toString().startsWith(".removing-")
|| plugin.getFileName().toString().startsWith(".")
&& !Files.isDirectory(plugin)
&& !plugin.getFileName().toString().equals(".DS_Store")) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we care about .DS_Store? It starts with . ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Without that it would fail the unit tests for DesktopServicesStore files

Copy link
Member

Choose a reason for hiding this comment

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

The code is wrong then. Isn't the intent to skip all . files?

Copy link
Member Author

@ryanbogan ryanbogan Oct 28, 2021

Choose a reason for hiding this comment

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

I don't think we should skip .DS_Store files in this method because an error needs to be thrown in readPluginBundle() if a .DS_Store is encountered. I'm trying to skip all . files except for those with this code.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe I don't understand what we're trying to accomplish. Why would we ignore .DS_Store? Because it's a well known special file? It's not expected in that folder AFAIK.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that was the reason, but if you think it's better to allow all . files, including .DS_Store, on startup I can implement that.

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 974e0b5

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 974e0b5

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 974e0b5
Log 960

Reports 960

@dblock dblock merged commit 286121f into opensearch-project:main Nov 4, 2021
@dblock dblock added the pending backport Identifies an issue or PR that still needs to be backported label Nov 4, 2021
@dblock
Copy link
Member

dblock commented Nov 4, 2021

Let's backport this into 1.x, and please check whether we say anything about this in docs - may need to be updated.

ryanbogan added a commit to ryanbogan/OpenSearch that referenced this pull request Nov 8, 2021
* Added logic to allow {dot} files on startup

Signed-off-by: Ryan Bogan <[email protected]>

* Ensures that only plugin directories are returned by findPluginDirs()

Signed-off-by: Ryan Bogan <[email protected]>

* Prevents . files from being returned as plugins

Signed-off-by: Ryan Bogan <[email protected]>
saratvemulapalli pushed a commit that referenced this pull request Nov 11, 2021
* Added logic to allow {dot} files on startup

Signed-off-by: Ryan Bogan <[email protected]>

* Ensures that only plugin directories are returned by findPluginDirs()

Signed-off-by: Ryan Bogan <[email protected]>

* Prevents . files from being returned as plugins

Signed-off-by: Ryan Bogan <[email protected]>
ryanbogan added a commit to ryanbogan/OpenSearch that referenced this pull request Nov 15, 2021
* Added logic to allow {dot} files on startup

Signed-off-by: Ryan Bogan <[email protected]>

* Ensures that only plugin directories are returned by findPluginDirs()

Signed-off-by: Ryan Bogan <[email protected]>

* Prevents . files from being returned as plugins

Signed-off-by: Ryan Bogan <[email protected]>
@tlfeng tlfeng added v1.2.0 Issues related to version 1.2.0 v2.0.0 Version 2.0.0 labels Nov 16, 2021
@dblock dblock removed the pending backport Identifies an issue or PR that still needs to be backported label Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.2.0 Issues related to version 1.2.0 v2.0.0 Version 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants