From 7920fa48c9fd716f4d5527277d45bf0401218941 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 27 Apr 2020 09:01:47 -0700 Subject: [PATCH] Only need to resolve the path of host-local if Flannel is enabled --- pkg/agent/config/config.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/agent/config/config.go b/pkg/agent/config/config.go index 52aa894cbc..7376217e7b 100644 --- a/pkg/agent/config/config.go +++ b/pkg/agent/config/config.go @@ -305,11 +305,6 @@ func get(envInfo *cmds.Agent) (*config.Node, error) { return nil, err } - hostLocal, err := exec.LookPath("host-local") - if err != nil { - return nil, errors.Wrapf(err, "failed to find host-local") - } - var flannelIface *sysnet.Interface if !envInfo.NoFlannel && len(envInfo.FlannelIface) > 0 { flannelIface, err = sysnet.InterfaceByName(envInfo.FlannelIface) @@ -443,6 +438,11 @@ func get(envInfo *cmds.Agent) (*config.Node, error) { } if !nodeConfig.NoFlannel { + hostLocal, err := exec.LookPath("host-local") + if err != nil { + return nil, errors.Wrapf(err, "failed to find host-local") + } + if envInfo.FlannelConf == "" { nodeConfig.FlannelConf = filepath.Join(envInfo.DataDir, "etc/flannel/net-conf.json") } else {