Skip to content

Commit

Permalink
Merge pull request #66 from s1061123/dev/change-missing-conf-name
Browse files Browse the repository at this point in the history
Change the message in case of missing CNI files
  • Loading branch information
openshift-merge-robot authored Dec 4, 2019
2 parents deac903 + cc146b3 commit e25b504
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/ocicni/ocicni.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ocicni
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
Expand Down Expand Up @@ -62,7 +61,7 @@ type cniNetwork struct {
config *libcni.NetworkConfigList
}

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

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

func (plugin *cniNetworkPlugin) Status() error {
if plugin.getDefaultNetwork() == nil {
return errMissingDefaultNetwork
return fmt.Errorf(errMissingDefaultNetwork, plugin.confDir)
}
return nil
}

0 comments on commit e25b504

Please # to comment.