Detect missing plugin binary wrt profiles (#1252)
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
This commit is contained in:
parent
5817fa4147
commit
43d5690432
|
@ -176,6 +176,7 @@ func (pb *PluginBroker) loadConfig(path string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checks whether every notification in profile has it's own config file
|
||||||
func (pb *PluginBroker) verifyPluginConfigsWithProfile() error {
|
func (pb *PluginBroker) verifyPluginConfigsWithProfile() error {
|
||||||
for _, profileCfg := range pb.profileConfigs {
|
for _, profileCfg := range pb.profileConfigs {
|
||||||
for _, pluginName := range profileCfg.Notifications {
|
for _, pluginName := range profileCfg.Notifications {
|
||||||
|
@ -188,6 +189,18 @@ func (pb *PluginBroker) verifyPluginConfigsWithProfile() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check whether each plugin in profile has it's own binary
|
||||||
|
func (pb *PluginBroker) verifyPluginBinaryWithProfile() error {
|
||||||
|
for _, profileCfg := range pb.profileConfigs {
|
||||||
|
for _, pluginName := range profileCfg.Notifications {
|
||||||
|
if _, ok := pb.notificationPluginByName[pluginName]; !ok {
|
||||||
|
return fmt.Errorf("binary for plugin %s not found", pluginName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (pb *PluginBroker) loadPlugins(path string) error {
|
func (pb *PluginBroker) loadPlugins(path string) error {
|
||||||
binaryPaths, err := listFilesAtPath(path)
|
binaryPaths, err := listFilesAtPath(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -231,7 +244,7 @@ func (pb *PluginBroker) loadPlugins(path string) error {
|
||||||
pb.notificationPluginByName[pc.Name] = pluginClient
|
pb.notificationPluginByName[pc.Name] = pluginClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return pb.verifyPluginBinaryWithProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pb *PluginBroker) loadNotificationPlugin(name string, binaryPath string) (Notifier, error) {
|
func (pb *PluginBroker) loadNotificationPlugin(name string, binaryPath string) (Notifier, error) {
|
||||||
|
|
Loading…
Reference in a new issue