Added a fallback to the vmware builder when trying to determine the networkmapping configuration.
Some instances of VMWare will not generate the networkmapping configuration (netmap.conf) at the time of installation. To deal with this issue, we check for the networkmapping file first, and then fallback to the networking file which also might exist and contain the interface information that we require. This fixes issue #10009.
This commit is contained in:
parent
9b997f28d5
commit
9b1d31cee7
|
@ -205,12 +205,29 @@ func (d *Player5Driver) Verify() error {
|
||||||
d.VmwareDriver.NetworkMapper = func() (NetworkNameMapper, error) {
|
d.VmwareDriver.NetworkMapper = func() (NetworkNameMapper, error) {
|
||||||
pathNetmap := playerNetmapConfPath()
|
pathNetmap := playerNetmapConfPath()
|
||||||
if _, err := os.Stat(pathNetmap); err != nil {
|
if _, err := os.Stat(pathNetmap); err != nil {
|
||||||
return nil, fmt.Errorf("Could not find netmap conf file: %s", pathNetmap)
|
|
||||||
}
|
|
||||||
log.Printf("Located networkmapper configuration file using Player: %s", pathNetmap)
|
log.Printf("Located networkmapper configuration file using Player: %s", pathNetmap)
|
||||||
|
|
||||||
return ReadNetmapConfig(pathNetmap)
|
return ReadNetmapConfig(pathNetmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we weren't able to find the networkmapper configuration file, then fall back
|
||||||
|
// to the networking file which might also be in the configuration directory.
|
||||||
|
libpath, _ := playerVMwareRoot()
|
||||||
|
pathNetworking := filepath.Join(libpath, "networking")
|
||||||
|
if _, err := os.Stat(pathNetworking); err != nil {
|
||||||
|
return nil, fmt.Errorf("Could not determine network mappings from files in path: %s", libpath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// We were able to successfully stat the file.. So, now we can open a handle to it.
|
||||||
|
log.Printf("Located networking configuration file using Player: %s", pathNetworking)
|
||||||
|
fd, err := os.Open(pathNetworking)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer fd.Close()
|
||||||
|
|
||||||
|
// Then we pass the handle to the networking configuration parser.
|
||||||
|
return ReadNetworkingConfig(fd)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,13 +165,30 @@ func (d *Workstation9Driver) Verify() error {
|
||||||
|
|
||||||
d.VmwareDriver.NetworkMapper = func() (NetworkNameMapper, error) {
|
d.VmwareDriver.NetworkMapper = func() (NetworkNameMapper, error) {
|
||||||
pathNetmap := workstationNetmapConfPath()
|
pathNetmap := workstationNetmapConfPath()
|
||||||
if _, err := os.Stat(pathNetmap); err != nil {
|
if _, err := os.Stat(pathNetmap); err == nil {
|
||||||
return nil, fmt.Errorf("Could not find netmap conf file: %s", pathNetmap)
|
|
||||||
}
|
|
||||||
log.Printf("Located networkmapper configuration file using Workstation: %s", pathNetmap)
|
log.Printf("Located networkmapper configuration file using Workstation: %s", pathNetmap)
|
||||||
|
|
||||||
return ReadNetmapConfig(pathNetmap)
|
return ReadNetmapConfig(pathNetmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we weren't able to find the networkmapper configuration file, then fall back
|
||||||
|
// to the networking file which might also be in the configuration directory.
|
||||||
|
libpath, _ := workstationVMwareRoot()
|
||||||
|
pathNetworking := filepath.Join(libpath, "networking")
|
||||||
|
if _, err := os.Stat(pathNetworking); err != nil {
|
||||||
|
return nil, fmt.Errorf("Could not determine network mappings from files in path: %s", libpath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// We were able to successfully stat the file.. So, now we can open a handle to it.
|
||||||
|
log.Printf("Located networking configuration file using Workstation: %s", pathNetworking)
|
||||||
|
fd, err := os.Open(pathNetworking)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer fd.Close()
|
||||||
|
|
||||||
|
// Then we pass the handle to the networking configuration parser.
|
||||||
|
return ReadNetworkingConfig(fd)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue