Fixed an issue identified by @SwampDragons when checking if the networkmapper configuration file exists.

This commit is contained in:
Ali Rizvi-Santiago 2021-02-21 05:32:30 -06:00
parent 9b1d31cee7
commit c7545c37dd
2 changed files with 7 additions and 1 deletions

View File

@ -204,7 +204,10 @@ 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 we were able to find the file (no error), then we can proceed with reading
// the networkmapper configuration.
if _, err := os.Stat(pathNetmap); err == nil {
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)
} }

View File

@ -165,6 +165,9 @@ func (d *Workstation9Driver) Verify() error {
d.VmwareDriver.NetworkMapper = func() (NetworkNameMapper, error) { d.VmwareDriver.NetworkMapper = func() (NetworkNameMapper, error) {
pathNetmap := workstationNetmapConfPath() pathNetmap := workstationNetmapConfPath()
// Check that the file for the networkmapper configuration exists. If there's no
// error, then the file exists and we can proceed to read the configuration out of it.
if _, err := os.Stat(pathNetmap); err == nil { if _, err := os.Stat(pathNetmap); err == nil {
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)