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

Fix Bug with Install demo configuration running in cluster mode with -y #3935

Merged
merged 10 commits into from
Jan 10, 2024

Conversation

derek-ho
Copy link
Collaborator

@derek-ho derek-ho commented Jan 10, 2024

Description

Previous behavior prior to 2.11 would be that init security and cluster mode would only be set if they were explicitly passed in. There is a small bug that is setting them to be true if -y is passed in. This is causing a few failures with duplicate keys in integration tests when -y is passed in.
https://github.com/opensearch-project/security/blob/2.11/tools/install_demo_configuration.sh#L73-L98

Issues Resolved

[List any issues this PR will resolve]

Is this a backport? If so, please add backport PR # and/or commits #

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
  • New functionality has been documented
  • 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.

@derek-ho
Copy link
Collaborator Author

Will fix #3775 #3876

Signed-off-by: Derek Ho <[email protected]>
@cwperks
Copy link
Member

cwperks commented Jan 10, 2024

Related issue: #2402

@cwperks
Copy link
Member

cwperks commented Jan 10, 2024

@derek-ho @DarshitChanpura What should the behavior of -y be for install_demo_configuration script? Generally, -y is an option in CLIs to automatically respond yes to all user prompts. There's a longstanding bug in the install_demo_configuration script with the -y option where it was not actually answering yes to all prompts.

It looks like the recent switch to implementing the demo configuration installer to Java fixed the bug, but it then introduced issues in the distribution build.

cwperks
cwperks previously approved these changes Jan 10, 2024
Copy link
Member

@cwperks cwperks left a comment

Choose a reason for hiding this comment

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

Approving as this is inline with previous behavior.

@derek-ho
Copy link
Collaborator Author

Approving as this is inline with previous behavior.

I added another test to verify this behavior.

@DarshitChanpura
Copy link
Member

@derek-ho @DarshitChanpura What should the behavior of -y be for install_demo_configuration script? Generally, -y is an option in CLIs to automatically respond yes to all user prompts. There's a longstanding bug in the install_demo_configuration script with the -y option where it was not actually answering yes to all prompts.

This what I assumed to when writing the Java code. But turns out that the original script did nothing to cluster_mode and init_security when -y was passed which was not the case when I wrote the Java code.

It looks like the recent switch to implementing the demo configuration installer to Java fixed the bug, but it then introduced issues in the distribution build.

Agreed that -y should inherently mark other options two options as yes, but since it is breaking builds rn, I'm happy to revert that bug fix and address it later. After this change is merged, -y will only be reduced to choosing yes for installing demo certificates and the other two prompts will be assumed as no.

An ideal usage would be to either use -y ( which automatically assumes yes for demo certs, cluster_mode and init_security)

OR pass individual options : -d for demo certs (new option), -c for cluster mode and -i for init security modules.

where -y will always take priority. But maybe that is for another release.

Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

Looks good. This existing bug which was addressed in original PR and is being reverted here, should be addressed in future.

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (045d4ef) 65.16% compared to head (60769b3) 65.17%.
Report is 2 commits behind head on main.

❗ Current head 60769b3 differs from pull request most recent head 3b5d54e. Consider uploading reports for the commit 3b5d54e to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3935   +/-   ##
=======================================
  Coverage   65.16%   65.17%           
=======================================
  Files         298      298           
  Lines       21218    21216    -2     
  Branches     3457     3457           
=======================================
  Hits        13827    13827           
+ Misses       5676     5675    -1     
+ Partials     1715     1714    -1     
Files Coverage Δ
...pensearch/security/tools/democonfig/Installer.java 71.34% <ø> (-0.34%) ⬇️

... and 1 file with indirect coverage changes

@DarshitChanpura DarshitChanpura added the backport 2.x backport to 2.x branch label Jan 10, 2024
@DarshitChanpura DarshitChanpura merged commit f217fa8 into opensearch-project:main Jan 10, 2024
79 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 10, 2024
…-y (#3935)

Previous behavior prior to 2.11 would be that init security and cluster
mode would only be set if they were explicitly passed in. There is a
small bug that is setting them to be true if -y is passed in. This is
causing a few failures with duplicate keys in integration tests when -y
is passed in.

https://github.com/opensearch-project/security/blob/2.11/tools/install_demo_configuration.sh#L73-L98

---------

Signed-off-by: Derek Ho <[email protected]>
(cherry picked from commit f217fa8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
DarshitChanpura pushed a commit that referenced this pull request Jan 10, 2024
…ster mode with -y (#3936)

Backport f217fa8 from #3935.

Signed-off-by: Derek Ho <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
dlin2028 pushed a commit to dlin2028/security that referenced this pull request May 1, 2024
…-y (opensearch-project#3935)


Previous behavior prior to 2.11 would be that init security and cluster
mode would only be set if they were explicitly passed in. There is a
small bug that is setting them to be true if -y is passed in. This is
causing a few failures with duplicate keys in integration tests when -y
is passed in.

https://github.com/opensearch-project/security/blob/2.11/tools/install_demo_configuration.sh#L73-L98

---------

Signed-off-by: Derek Ho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants