drivermanager: use correct plugin config types

This commit is contained in:
Nick Ethier 2018-12-18 23:07:01 -05:00
parent a02308ee6a
commit 6f1777284d
No known key found for this signature in database
GPG key ID: 07C1A3ECED90D24A
3 changed files with 9 additions and 9 deletions

View file

@ -42,7 +42,7 @@ type instanceManagerConfig struct {
FetchReattach FetchPluginReattachFn FetchReattach FetchPluginReattachFn
// PluginConfig is the config passed to the launched plugins // PluginConfig is the config passed to the launched plugins
PluginConfig *base.ClientAgentConfig PluginConfig *base.AgentConfig
// ID is the ID of the plugin being managed // ID is the ID of the plugin being managed
ID *loader.PluginID ID *loader.PluginID
@ -75,7 +75,7 @@ type instanceManager struct {
fetchReattach FetchPluginReattachFn fetchReattach FetchPluginReattachFn
// pluginConfig is the config passed to the launched plugins // pluginConfig is the config passed to the launched plugins
pluginConfig *base.ClientAgentConfig pluginConfig *base.AgentConfig
// id is the ID of the plugin being managed // id is the ID of the plugin being managed
id *loader.PluginID id *loader.PluginID

View file

@ -29,7 +29,7 @@ type Manager interface {
Dispense(driver string) (drivers.DriverPlugin, error) Dispense(driver string) (drivers.DriverPlugin, error)
} }
// EventHandler can is a callback to be called for a task. // EventHandler is a callback to be called for a task.
// The handler should not block execution. // The handler should not block execution.
type EventHandler func(*drivers.TaskEvent) type EventHandler func(*drivers.TaskEvent)
@ -68,7 +68,7 @@ type Config struct {
Loader loader.PluginCatalog Loader loader.PluginCatalog
// PluginConfig is the config passed to the launched plugins // PluginConfig is the config passed to the launched plugins
PluginConfig *base.ClientAgentConfig PluginConfig *base.AgentConfig
// Updater is used to update the node when driver information changes // Updater is used to update the node when driver information changes
Updater UpdateNodeDriverInfoFn Updater UpdateNodeDriverInfoFn
@ -103,7 +103,7 @@ type manager struct {
loader loader.PluginCatalog loader loader.PluginCatalog
// pluginConfig is the config passed to the launched plugins // pluginConfig is the config passed to the launched plugins
pluginConfig *base.ClientAgentConfig pluginConfig *base.AgentConfig
// updater is used to update the node when device information changes // updater is used to update the node when device information changes
updater UpdateNodeDriverInfoFn updater UpdateNodeDriverInfoFn

View file

@ -33,7 +33,7 @@ func testSetup(t *testing.T) (chan *drivers.Fingerprint, chan *drivers.TaskEvent
cfg := &Config{ cfg := &Config{
Logger: testlog.HCLogger(t), Logger: testlog.HCLogger(t),
Loader: cat, Loader: cat,
PluginConfig: &base.ClientAgentConfig{}, PluginConfig: &base.AgentConfig{},
Updater: noopUpdater, Updater: noopUpdater,
EventHandlerFactory: noopEventHandlerFactory, EventHandlerFactory: noopEventHandlerFactory,
State: state.NoopDB{}, State: state.NoopDB{},
@ -68,19 +68,19 @@ func mockCatalog(drivers map[string]drivers.DriverPlugin) *loader.MockCatalog {
} }
return &loader.MockCatalog{ return &loader.MockCatalog{
DispenseF: func(name, pluginType string, cfg *base.ClientAgentConfig, logger log.Logger) (loader.PluginInstance, error) { DispenseF: func(name, pluginType string, cfg *base.AgentConfig, logger log.Logger) (loader.PluginInstance, error) {
d, ok := drivers[name] d, ok := drivers[name]
if !ok { if !ok {
return nil, fmt.Errorf("driver not found") return nil, fmt.Errorf("driver not found")
} }
return loader.MockBasicExternalPlugin(d), nil return loader.MockBasicExternalPlugin(d, "0.1.0"), nil
}, },
ReattachF: func(name, pluginType string, config *plugin.ReattachConfig) (loader.PluginInstance, error) { ReattachF: func(name, pluginType string, config *plugin.ReattachConfig) (loader.PluginInstance, error) {
d, ok := drivers[name] d, ok := drivers[name]
if !ok { if !ok {
return nil, fmt.Errorf("driver not found") return nil, fmt.Errorf("driver not found")
} }
return loader.MockBasicExternalPlugin(d), nil return loader.MockBasicExternalPlugin(d, "0.1.0"), nil
}, },
CatalogF: func() map[string][]*base.PluginInfoResponse { CatalogF: func() map[string][]*base.PluginInfoResponse {
return cat return cat