De-duplicate component type factory map
This commit is contained in:
parent
d004125712
commit
254c462add
@ -169,18 +169,9 @@ func ProtoToFlagsMapper(input []*vagrant_server.Job_Flag) (opt []*option.Option,
|
||||
// NewBasis creates a new Basis with the given options.
|
||||
func NewBasis(ctx context.Context, opts ...BasisOption) (b *Basis, err error) {
|
||||
b = &Basis{
|
||||
logger: hclog.L(),
|
||||
jobInfo: &component.JobInfo{},
|
||||
factories: map[component.Type]*factory.Factory{
|
||||
component.CommandType: plugin.BaseFactories[component.CommandType],
|
||||
component.CommunicatorType: plugin.BaseFactories[component.CommunicatorType],
|
||||
component.ConfigType: plugin.BaseFactories[component.ConfigType],
|
||||
component.GuestType: plugin.BaseFactories[component.GuestType],
|
||||
component.HostType: plugin.BaseFactories[component.HostType],
|
||||
component.ProviderType: plugin.BaseFactories[component.ProviderType],
|
||||
component.ProvisionerType: plugin.BaseFactories[component.ProvisionerType],
|
||||
component.SyncedFolderType: plugin.BaseFactories[component.SyncedFolderType],
|
||||
},
|
||||
logger: hclog.L(),
|
||||
jobInfo: &component.JobInfo{},
|
||||
factories: plugin.BaseFactories,
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
|
||||
@ -89,24 +89,12 @@ func New(opts ...Option) (*Runner, error) {
|
||||
|
||||
// Our default runner
|
||||
runner := &Runner{
|
||||
id: id,
|
||||
logger: hclog.L(),
|
||||
ctx: context.Background(),
|
||||
runner: &vagrant_server.Runner{Id: id},
|
||||
opConfig: &intcfg.Config{},
|
||||
factories: map[component.Type]*factory.Factory{
|
||||
component.MapperType: plugin.BaseFactories[component.MapperType],
|
||||
component.CommandType: plugin.BaseFactories[component.CommandType],
|
||||
component.CommunicatorType: plugin.BaseFactories[component.CommunicatorType],
|
||||
component.ConfigType: plugin.BaseFactories[component.ConfigType],
|
||||
component.GuestType: plugin.BaseFactories[component.GuestType],
|
||||
component.HostType: plugin.BaseFactories[component.HostType],
|
||||
component.LogPlatformType: plugin.BaseFactories[component.LogPlatformType],
|
||||
component.LogViewerType: plugin.BaseFactories[component.LogViewerType],
|
||||
component.ProviderType: plugin.BaseFactories[component.ProviderType],
|
||||
component.ProvisionerType: plugin.BaseFactories[component.ProvisionerType],
|
||||
component.SyncedFolderType: plugin.BaseFactories[component.SyncedFolderType],
|
||||
},
|
||||
id: id,
|
||||
logger: hclog.L(),
|
||||
ctx: context.Background(),
|
||||
runner: &vagrant_server.Runner{Id: id},
|
||||
opConfig: &intcfg.Config{},
|
||||
factories: plugin.BaseFactories,
|
||||
}
|
||||
|
||||
// Build our config
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user