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

Remove LockConfiguration.LockName #46772

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e
Submodule e updated from 939177 to 0911ef
9 changes: 1 addition & 8 deletions lib/backend/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ func randomID() ([]byte, error) {
type LockConfiguration struct {
// Backend to create the lock in.
Backend Backend
// LockName the precomputed lock name.
// TODO(tross) DELETE WHEN teleport.e is updated to use LockNameComponents.
LockName string
// LockNameComponents are subcomponents to be used when constructing
// the lock name.
LockNameComponents []string
Expand All @@ -71,12 +68,8 @@ func (l *LockConfiguration) CheckAndSetDefaults() error {
if l.Backend == nil {
return trace.BadParameter("missing Backend")
}
if l.LockName == "" && len(l.LockNameComponents) == 0 {
return trace.BadParameter("missing LockName/LockNameComponents")
}

if len(l.LockNameComponents) == 0 {
l.LockNameComponents = []string{l.LockName}
return trace.BadParameter("missing LockNameComponents")
}

if l.TTL == 0 {
Expand Down
7 changes: 3 additions & 4 deletions lib/backend/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func TestLockConfiguration_CheckAndSetDefaults(t *testing.T) {
wantErr: "missing Backend",
},
{
name: "missing lock name",
name: "missing lock components",
in: LockConfiguration{
Backend: mockBackend{},
LockName: "",
Backend: mockBackend{},
LockNameComponents: nil,
},
wantErr: "missing LockName",
},
Expand Down Expand Up @@ -143,7 +143,6 @@ func TestRunWhileLockedConfigCheckAndSetDefaults(t *testing.T) {
name: "errors from LockConfiguration is passed",
input: func() RunWhileLockedConfig {
cfg := minimumValidConfig
cfg.LockName = ""
cfg.LockNameComponents = nil
return cfg
},
Expand Down
Loading