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
This commit is contained in:
Marcus Efraimsson 2020-07-16 10:36:08 +02:00 committed by GitHub
parent 35f7f7b50a
commit b97d1f4170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 21 deletions

View File

@ -34,11 +34,7 @@ var (
)
func init() {
registry.Register(&registry.Descriptor{
Name: "BackendPluginManager",
Instance: &manager{},
InitPriority: registry.Low,
})
registry.RegisterService(&manager{})
}
// Manager manages backend plugins.

View File

@ -20,7 +20,7 @@ func RegisterService(instance Service) {
services = append(services, &Descriptor{
Name: reflect.TypeOf(instance).Elem().Name(),
Instance: instance,
InitPriority: Low,
InitPriority: Medium,
})
}
@ -114,6 +114,7 @@ func IsDisabled(srv Service) bool {
type Priority int
const (
High Priority = 100
Low Priority = 0
High Priority = 100
Medium Priority = 50
Low Priority = 0
)

View File

@ -25,14 +25,18 @@ type ProvisioningService interface {
}
func init() {
registry.RegisterService(NewProvisioningServiceImpl(
func(path string) (dashboards.DashboardProvisioner, error) {
return dashboards.New(path)
},
notifiers.Provision,
datasources.Provision,
plugins.Provision,
))
registry.Register(&registry.Descriptor{
Name: "ProvisioningService",
Instance: NewProvisioningServiceImpl(
func(path string) (dashboards.DashboardProvisioner, error) {
return dashboards.New(path)
},
notifiers.Provision,
datasources.Provision,
plugins.Provision,
),
InitPriority: registry.Low,
})
}
func NewProvisioningServiceImpl(

View File

@ -11,11 +11,7 @@ import (
)
func init() {
registry.Register(&registry.Descriptor{
Name: "SearchService",
Instance: &SearchService{},
InitPriority: 20,
})
registry.RegisterService(&SearchService{})
}
type Query struct {