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
1 changed files with 14 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue