diff --git a/pkg/crc/preflight/preflight_checks_linux.go b/pkg/crc/preflight/preflight_checks_linux.go index 48cb4a9631..9f057ec904 100644 --- a/pkg/crc/preflight/preflight_checks_linux.go +++ b/pkg/crc/preflight/preflight_checks_linux.go @@ -24,23 +24,10 @@ import ( ) const ( - crcDnsmasqConfigFile = "crc.conf" - crcNetworkManagerConfigFile = "crc-nm-dnsmasq.conf" // This is defined in https://github.com/code-ready/machine-driver-libvirt/blob/master/go.mod#L5 minSupportedLibvirtVersion = "3.4.0" ) -var ( - crcDnsmasqConfigPath = filepath.Join(string(filepath.Separator), "etc", "NetworkManager", "dnsmasq.d", crcDnsmasqConfigFile) - crcDnsmasqConfig = `server=/apps-crc.testing/192.168.130.11 -server=/crc.testing/192.168.130.11 -` - crcNetworkManagerConfigPath = filepath.Join(string(filepath.Separator), "etc", "NetworkManager", "conf.d", crcNetworkManagerConfigFile) - crcNetworkManagerConfig = `[main] -dns=dnsmasq -` -) - func checkVirtualizationEnabled() error { logging.Debug("Checking if the vmx/svm flags are present in /proc/cpuinfo") // Check if the cpu flags vmx or svm is present diff --git a/pkg/crc/preflight/preflight_checks_network_linux.go b/pkg/crc/preflight/preflight_checks_network_linux.go index af9fb4ef88..953420b4c4 100644 --- a/pkg/crc/preflight/preflight_checks_network_linux.go +++ b/pkg/crc/preflight/preflight_checks_network_linux.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "os/exec" + "path/filepath" "github.com/code-ready/crc/pkg/crc/logging" "github.com/code-ready/crc/pkg/crc/systemd" @@ -51,6 +52,20 @@ var dnsmasqPreflightChecks = [...]Check{ }, } +var ( + crcNetworkManagerRootPath = filepath.Join(string(filepath.Separator), "etc", "NetworkManager") + + crcDnsmasqConfigPath = filepath.Join(crcNetworkManagerRootPath, "dnsmasq.d", "crc.conf") + crcDnsmasqConfig = `server=/apps-crc.testing/192.168.130.11 +server=/crc.testing/192.168.130.11 +` + + crcNetworkManagerConfigPath = filepath.Join(crcNetworkManagerRootPath, "conf.d", "crc-nm-dnsmasq.conf") + crcNetworkManagerConfig = `[main] +dns=dnsmasq +` +) + func fixNetworkManagerConfigFile(path string, content string, perms os.FileMode) error { err := crcos.WriteToFileAsRoot( fmt.Sprintf("write NetworkManager configuration to %s", path),