| @@ -73,9 +73,9 @@ func validateCloudConfig(config []byte, rules []rule) (report Report, err error) | ||||
| // any parsing issues into the provided report. Unrecoverable errors are | ||||
| // returned as an error. | ||||
| func parseCloudConfig(cfg []byte, report *Report) (node, error) { | ||||
| 	yaml.UnmarshalMappingKeyTransform = func(nameIn string) (nameOut string) { | ||||
| 		return nameIn | ||||
| 	} | ||||
| 	//	yaml.UnmarshalMappingKeyTransform = func(nameIn string) (nameOut string) { | ||||
| 	//		return nameIn | ||||
| 	//	} | ||||
| 	// unmarshal the config into an implicitly-typed form. The yaml library | ||||
| 	// will implicitly convert types into their normalized form | ||||
| 	// (e.g. 0744 -> 484, off -> false). | ||||
| @@ -104,9 +104,9 @@ func parseCloudConfig(cfg []byte, report *Report) (node, error) { | ||||
| 	w = normalizeNodeNames(w, report) | ||||
|  | ||||
| 	// unmarshal the config into the explicitly-typed form. | ||||
| 	yaml.UnmarshalMappingKeyTransform = func(nameIn string) (nameOut string) { | ||||
| 		return strings.Replace(nameIn, "-", "_", -1) | ||||
| 	} | ||||
| 	//	yaml.UnmarshalMappingKeyTransform = func(nameIn string) (nameOut string) { | ||||
| 	//		return strings.Replace(nameIn, "-", "_", -1) | ||||
| 	//	} | ||||
| 	var strong config.CloudConfig | ||||
| 	if err := yaml.Unmarshal([]byte(cfg), &strong); err != nil { | ||||
| 		return node{}, err | ||||
|   | ||||
| @@ -21,9 +21,9 @@ import ( | ||||
| 	"os/exec" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/vishvananda/netlink" | ||||
| 	"github.com/vtolstov/cloudinit/config" | ||||
| 	"github.com/vtolstov/cloudinit/network" | ||||
| 	"github.com/vishvananda/netlink" | ||||
| ) | ||||
|  | ||||
| func RestartNetwork(interfaces []network.InterfaceGenerator) (err error) { | ||||
| @@ -57,7 +57,11 @@ func downNetworkInterfaces(interfaces []network.InterfaceGenerator) error { | ||||
| 	for _, iface := range interfaces { | ||||
| 		if systemInterface, ok := sysInterfaceMap[iface.Name()]; ok { | ||||
| 			log.Printf("Taking down interface %q\n", systemInterface.Name) | ||||
| 			if err := netlink.NetworkLinkDown(systemInterface); err != nil { | ||||
| 			link, err := netlink.LinkByName(systemInterface.Name) | ||||
| 			if err != nil { | ||||
| 				fmt.Printf("Error while downing interface %q (%s). Continuing...\n", systemInterface.Name, err) | ||||
| 			} | ||||
| 			if err = netlink.LinkSetDown(link); err != nil { | ||||
| 				fmt.Printf("Error while downing interface %q (%s). Continuing...\n", systemInterface.Name, err) | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user