Detect missing plugin binary wrt profiles
@@ -176,6 +176,7 @@ func (pb *PluginBroker) loadConfig(path string) error {
return err
}
+// checks whether every notification in profile has it's own config file
func (pb *PluginBroker) verifyPluginConfigsWithProfile() error {
for _, profileCfg := range pb.profileConfigs {
for _, pluginName := range profileCfg.Notifications {
@@ -188,6 +189,18 @@ func (pb *PluginBroker) verifyPluginConfigsWithProfile() error {
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 {
binaryPaths, err := listFilesAtPath(path)
if err != nil {
@@ -231,7 +244,7 @@ func (pb *PluginBroker) loadPlugins(path string) error {
pb.notificationPluginByName[pc.Name] = pluginClient
}
}
- return err
+ return pb.verifyPluginBinaryWithProfile()
}
func (pb *PluginBroker) loadNotificationPlugin(name string, binaryPath string) (Notifier, error) {
