Commit b97d1f41 by Marcus Efraimsson Committed by GitHub

Provisioning: Fix bug when provision app plugins using Enterprise edition (#26340)

In OSS provisioning service init after plugin registration, but in
Enterprise it's the opposite order and installed app plugin check
fails. This adjusts service registry init priority to make sure plugins
are registered before provisioning inits.

Which issue(s) this PR fixes:
Fixes #26336
parent 35f7f7b5
...@@ -34,11 +34,7 @@ var ( ...@@ -34,11 +34,7 @@ var (
) )
func init() { func init() {
registry.Register(&registry.Descriptor{ registry.RegisterService(&manager{})
Name: "BackendPluginManager",
Instance: &manager{},
InitPriority: registry.Low,
})
} }
// Manager manages backend plugins. // Manager manages backend plugins.
......
...@@ -20,7 +20,7 @@ func RegisterService(instance Service) { ...@@ -20,7 +20,7 @@ func RegisterService(instance Service) {
services = append(services, &Descriptor{ services = append(services, &Descriptor{
Name: reflect.TypeOf(instance).Elem().Name(), Name: reflect.TypeOf(instance).Elem().Name(),
Instance: instance, Instance: instance,
InitPriority: Low, InitPriority: Medium,
}) })
} }
...@@ -114,6 +114,7 @@ func IsDisabled(srv Service) bool { ...@@ -114,6 +114,7 @@ func IsDisabled(srv Service) bool {
type Priority int type Priority int
const ( const (
High Priority = 100 High Priority = 100
Low Priority = 0 Medium Priority = 50
Low Priority = 0
) )
...@@ -25,14 +25,18 @@ type ProvisioningService interface { ...@@ -25,14 +25,18 @@ type ProvisioningService interface {
} }
func init() { func init() {
registry.RegisterService(NewProvisioningServiceImpl( registry.Register(&registry.Descriptor{
func(path string) (dashboards.DashboardProvisioner, error) { Name: "ProvisioningService",
return dashboards.New(path) Instance: NewProvisioningServiceImpl(
}, func(path string) (dashboards.DashboardProvisioner, error) {
notifiers.Provision, return dashboards.New(path)
datasources.Provision, },
plugins.Provision, notifiers.Provision,
)) datasources.Provision,
plugins.Provision,
),
InitPriority: registry.Low,
})
} }
func NewProvisioningServiceImpl( func NewProvisioningServiceImpl(
......
...@@ -11,11 +11,7 @@ import ( ...@@ -11,11 +11,7 @@ import (
) )
func init() { func init() {
registry.Register(&registry.Descriptor{ registry.RegisterService(&SearchService{})
Name: "SearchService",
Instance: &SearchService{},
InitPriority: 20,
})
} }
type Query struct { type Query struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment