Skip to content

Commit

Permalink
Remove LockConfiguration.LockName (#46772)
Browse files Browse the repository at this point in the history
Cleans up the deprecated config option now that
gravitational/teleport.e#5034 has been
merged.
  • Loading branch information
rosstimothy authored and mvbrock committed Sep 19, 2024
1 parent 2881f07 commit a5ec9d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
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

0 comments on commit a5ec9d0

Please sign in to comment.