-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Simplify a lot of the mount tuning code #3285
Conversation
Make leases much simpler by not trying to compare against system default/max -- a bit of a fool's errand since a change to config files can flip whether it's even valid. For extra credit, add the ability to tune description; closes #2645
vault/logical_system.go
Outdated
b.Backend.Logger().Error("sys: tune failed: no mount entry found", "path", path) | ||
return handleError(fmt.Errorf("sys: tune of path '%s' failed: no mount entry found", path)) | ||
} | ||
if mountEntry != nil && !mountEntry.Local && repState == consts.ReplicationSecondary { |
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.
This should use the HasState function:
repState.HasState(consts.ReplicationPerformanceSecondary)
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.
It's a copy and paste from above, which means it got missed before too :-/
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.
It was changed in my locking PR, so i think it has since been updated.
vault/logical_system.go
Outdated
@@ -1586,7 +1606,31 @@ func (b *SystemBackend) handleTuneWriteCommon( | |||
} | |||
} | |||
|
|||
return nil, nil | |||
var resp *logical.Response |
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.
This doesn't seem to be used anywhere, should we just return nil, nil
below?
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.
Ah, it was used for a warning before but that code is now removed, will fix it.
return fmt.Errorf("new backend default lease TTL of %d greater than backend max lease TTL of %d", | ||
int(newDefault.Seconds()), int(meConfig.MaxLeaseTTL.Seconds())) | ||
} | ||
case newDefault != zero && newMax != zero: |
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.
This switch statement might be cleaner if it only had this case and a default case. Unless you like the verbosity of the other statements + comments.
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.
In this instance I found it useful to think through the different cases and leave appropriate comments.
LGTM aside from the comments that Brian left. |
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.
Looks good!
Travis failure is from intermittent Cassandra failure; merging. |
Make leases much simpler by not trying to compare against system
default/max -- a bit of a fool's errand since a change to config files
can flip whether it's even valid.
For extra credit, add the ability to tune description; closes #2645