Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
murali-reddy authored and aauren committed Oct 2, 2020
1 parent db1bd56 commit 947bb24
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/controllers/routing/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,17 @@ func (nrc *NetworkRoutingController) updateCNIConfig() {

func (nrc *NetworkRoutingController) autoConfigureMTU() error {
mtu, err := getMTUFromNodeIP(nrc.nodeIP)
if err != nil {
return fmt.Errorf("failed to generate MTU: %s", err.Error())
}
file, err := ioutil.ReadFile(nrc.cniConfFile)
if err != nil {
return fmt.Errorf("Failed to load CNI conf file: %s", err.Error())
return fmt.Errorf("failed to load CNI conf file: %s", err.Error())
}
var config interface{}
err = json.Unmarshal(file, &config)
if err != nil {
return fmt.Errorf("Failed to parse JSON from CNI conf file: %s", err.Error())
return fmt.Errorf("failed to parse JSON from CNI conf file: %s", err.Error())
}
if strings.HasSuffix(nrc.cniConfFile, ".conflist") {
configMap := config.(map[string]interface{})
Expand All @@ -379,7 +382,7 @@ func (nrc *NetworkRoutingController) autoConfigureMTU() error {
configJSON, _ := json.Marshal(config)
err = ioutil.WriteFile(nrc.cniConfFile, configJSON, 0644)
if err != nil {
return fmt.Errorf("Failed to insert `mtu` into CNI conf file: %s", err.Error())
return fmt.Errorf("failed to insert `mtu` into CNI conf file: %s", err.Error())
}
return nil
}
Expand Down

0 comments on commit 947bb24

Please sign in to comment.