ExtSvcAuth: Refactor external service registry to use ExternalServiceRegistry variables (#78056)
ExtSvcAuth: Refactor external service registry to use ExternalServiceRegistry
This commit is contained in:
@@ -437,8 +437,8 @@ type FakeAuthService struct {
|
||||
Result *auth.ExternalService
|
||||
}
|
||||
|
||||
func (f *FakeAuthService) HasExternalService(ctx context.Context, pluginID string) bool {
|
||||
return f.Result != nil
|
||||
func (f *FakeAuthService) HasExternalService(ctx context.Context, pluginID string) (bool, error) {
|
||||
return f.Result != nil, nil
|
||||
}
|
||||
|
||||
func (f *FakeAuthService) RegisterExternalService(ctx context.Context, pluginID string, pType plugindef.Type, svc *plugindef.ExternalServiceRegistration) (*auth.ExternalService, error) {
|
||||
|
||||
@@ -160,10 +160,11 @@ func (m *PluginInstaller) Remove(ctx context.Context, pluginID string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if m.serviceRegistry.HasExternalService(ctx, pluginID) {
|
||||
has, err := m.serviceRegistry.HasExternalService(ctx, pluginID)
|
||||
if err == nil && has {
|
||||
return m.serviceRegistry.RemoveExternalService(ctx, pluginID)
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
// plugin finds a plugin with `pluginID` from the store
|
||||
|
||||
Reference in New Issue
Block a user