Skip to content

Commit 1743a25

Browse files
backport of commit cb498b9 (#27901)
Co-authored-by: Chris Roberts <croberts@hashicorp.com>
1 parent ea150b3 commit 1743a25

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

helper/pluginutils/loader/loader.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ func (l *PluginLoader) Dispense(name, pluginType string, config *base.AgentConfi
174174
// Cast to the base type and set the config
175175
b, ok := instance.Plugin().(base.BasePlugin)
176176
if !ok {
177+
instance.Kill() // Ensure plugin is not left running
177178
return nil, fmt.Errorf("plugin %s doesn't implement base plugin interface", id)
178179
}
179180

@@ -184,6 +185,7 @@ func (l *PluginLoader) Dispense(name, pluginType string, config *base.AgentConfi
184185
}
185186

186187
if err := b.SetConfig(c); err != nil {
188+
instance.Kill() // ensure plugin is not left running
187189
return nil, fmt.Errorf("setting config for plugin %s failed: %v", id, err)
188190
}
189191

0 commit comments

Comments
 (0)