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

PMM-7 Don't panic in case of path to encryption file doesn't exist. #3307

Open
wants to merge 3 commits into
base: v3
Choose a base branch
from

Conversation

BupycHuk
Copy link
Member

PMM-7

Link to the Feature Build: SUBMODULES-0

If this PR adds or removes or alters one or more API endpoints, please review and add or update the relevant API documents as well:

  • API Docs updated

If this PR is related to some other PRs in this or other repositories, please provide links to those PRs:

  • Links to related pull requests (optional).

@BupycHuk BupycHuk requested a review from a team as a code owner November 14, 2024 09:16
@BupycHuk BupycHuk requested review from idoqo and JiriCtvrtka and removed request for a team November 14, 2024 09:16
defaultEncryptionMtx.Unlock()
defer defaultEncryptionMtx.Unlock()
DefaultEncryption, err = New()
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Would 'return err' suffice?

Copy link
Member Author

Choose a reason for hiding this comment

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

do you think we need to panic? it will be returned by stack to main

Copy link
Member

Choose a reason for hiding this comment

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

Pardon me, I believed

if err != nil {
  	return err
}

return nil

was an equivalent of return err.

Is it not?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, good point

@@ -81,21 +80,22 @@ func New() *Encryption {
case os.IsNotExist(err):
err = e.generateKey()
if err != nil {
logrus.Panicf("Encryption: %v", err)
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it make sense to continue if PMM is not able to generate encryption key?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can't run tests locally because of this panic

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Ok

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 43.50%. Comparing base (4ee890d) to head (a4418c5).

Files with missing lines Patch % Lines
managed/utils/encryption/encryption.go 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #3307      +/-   ##
==========================================
- Coverage   43.53%   43.50%   -0.04%     
==========================================
  Files         366      366              
  Lines       44162    44161       -1     
==========================================
- Hits        19228    19213      -15     
- Misses      23254    23266      +12     
- Partials     1680     1682       +2     
Flag Coverage Δ
managed 45.25% <62.50%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants