-
Notifications
You must be signed in to change notification settings - Fork 131
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
base: v3
Are you sure you want to change the base?
Conversation
defaultEncryptionMtx.Unlock() | ||
defer defaultEncryptionMtx.Unlock() | ||
DefaultEncryption, err = New() | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would 'return err' suffice?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Ok
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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:
If this PR is related to some other PRs in this or other repositories, please provide links to those PRs: