Browse Source

util/syspolicy: delete some unused code in handler.go

There's a TODO to delete all of handler.go, but part of it's
still used in another repo.

But this deletes some.

Updates #17022

Change-Id: Ic5a8a5a694ca258440307436731cd92b45ee2d21
Signed-off-by: Brad Fitzpatrick <[email protected]>
Brad Fitzpatrick 6 months ago
parent
commit
0f3598b467
1 changed files with 2 additions and 17 deletions
  1. 2 17
      util/syspolicy/handler.go

+ 2 - 17
util/syspolicy/handler.go

@@ -8,7 +8,6 @@ import (
 	"tailscale.com/util/syspolicy/rsop"
 	"tailscale.com/util/syspolicy/setting"
 	"tailscale.com/util/syspolicy/source"
-	"tailscale.com/util/testenv"
 )
 
 // TODO(nickkhyl): delete this file once other repos are updated.
@@ -36,19 +35,10 @@ type Handler interface {
 //
 // Deprecated: using [RegisterStore] should be preferred.
 func RegisterHandler(h Handler) {
-	rsop.RegisterStore("DeviceHandler", setting.DeviceScope, WrapHandler(h))
+	rsop.RegisterStore("DeviceHandler", setting.DeviceScope, handlerStore{h})
 }
 
-// SetHandlerForTest wraps and sets the specified handler as the device's policy
-// [source.Store] for the duration of tb.
-//
-// Deprecated: using [MustRegisterStoreForTest] should be preferred.
-func SetHandlerForTest(tb testenv.TB, h Handler) {
-	RegisterWellKnownSettingsForTest(tb)
-	MustRegisterStoreForTest(tb, "DeviceHandler-TestOnly", setting.DefaultScope(), WrapHandler(h))
-}
-
-var _ source.Store = (*handlerStore)(nil)
+var _ source.Store = handlerStore{}
 
 // handlerStore is a [source.Store] that calls the underlying [Handler].
 //
@@ -57,11 +47,6 @@ type handlerStore struct {
 	h Handler
 }
 
-// WrapHandler returns a [source.Store] that wraps the specified [Handler].
-func WrapHandler(h Handler) source.Store {
-	return handlerStore{h}
-}
-
 // Lock implements [source.Lockable].
 func (s handlerStore) Lock() error {
 	if lockable, ok := s.h.(source.Lockable); ok {