diff --git a/builder/node.go b/builder/node.go index 7bfbf2a129d..1b8e1cfce6e 100644 --- a/builder/node.go +++ b/builder/node.go @@ -45,7 +45,8 @@ func (b *Builder) Nodes() []Node { type LoadNodesOption func(*loadNodesOptions) type loadNodesOptions struct { - data bool + data bool + dialMeta map[string][]string } func WithData() LoadNodesOption { @@ -54,6 +55,12 @@ func WithData() LoadNodesOption { } } +func WithDialMeta(dialMeta map[string][]string) LoadNodesOption { + return func(o *loadNodesOptions) { + o.dialMeta = dialMeta + } +} + // LoadNodes loads and returns nodes for this builder. // TODO: this should be a method on a Node object and lazy load data for each driver. func (b *Builder) LoadNodes(ctx context.Context, opts ...LoadNodesOption) (_ []Node, err error) { @@ -141,7 +148,7 @@ func (b *Builder) LoadNodes(ctx context.Context, opts ...LoadNodesOption) (_ []N node.ImageOpt = imageopt if lno.data { - if err := node.loadData(ctx); err != nil { + if err := node.loadData(ctx, lno.dialMeta); err != nil { node.Err = err } } @@ -192,7 +199,7 @@ func (b *Builder) LoadNodes(ctx context.Context, opts ...LoadNodesOption) (_ []N return b.nodes, nil } -func (n *Node) loadData(ctx context.Context) error { +func (n *Node) loadData(ctx context.Context, dialMeta map[string][]string) error { if n.Driver == nil { return nil } @@ -204,7 +211,7 @@ func (n *Node) loadData(ctx context.Context) error { n.DriverInfo = info if n.DriverInfo.Status == driver.Running { - c, err := n.Driver.Client(ctx) + c, err := n.Driver.Client(ctx, driver.WithDialMeta(dialMeta)) if err != nil { return err }