Skip to content

Commit e25b504

Browse files
Merge pull request #66 from s1061123/dev/change-missing-conf-name
Change the message in case of missing CNI files
2 parents deac903 + cc146b3 commit e25b504

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/ocicni/ocicni.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package ocicni
33
import (
44
"context"
55
"encoding/json"
6-
"errors"
76
"fmt"
87
"io/ioutil"
98
"net"
@@ -62,7 +61,7 @@ type cniNetwork struct {
6261
config *libcni.NetworkConfigList
6362
}
6463

65-
var errMissingDefaultNetwork = errors.New("Missing CNI default network")
64+
var errMissingDefaultNetwork = "No CNI configuration file in %s. Has your network provider started?"
6665

6766
type podLock struct {
6867
// Count of in-flight operations for this pod; when this reaches zero
@@ -413,7 +412,7 @@ func (plugin *cniNetworkPlugin) getDefaultNetwork() *cniNetwork {
413412
// to attach the pod to.
414413
func (plugin *cniNetworkPlugin) networksAvailable(podNetwork *PodNetwork) error {
415414
if len(podNetwork.Networks) == 0 && plugin.getDefaultNetwork() == nil {
416-
return errMissingDefaultNetwork
415+
return fmt.Errorf(errMissingDefaultNetwork, plugin.confDir)
417416
}
418417
return nil
419418
}
@@ -854,7 +853,7 @@ func buildCNIRuntimeConf(cacheDir string, podNetwork *PodNetwork, ifName string,
854853

855854
func (plugin *cniNetworkPlugin) Status() error {
856855
if plugin.getDefaultNetwork() == nil {
857-
return errMissingDefaultNetwork
856+
return fmt.Errorf(errMissingDefaultNetwork, plugin.confDir)
858857
}
859858
return nil
860859
}

0 commit comments

Comments
 (0)