mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-11 09:40:17 -04:00
Merge pull request #1989 from marcomorain/upper-case-mac-address
Fix for VMWare on OSX – MAC address can be upper or lower case
This commit is contained in:
commit
7bd618b56b
1 changed files with 3 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package common
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
|
@ -75,14 +76,14 @@ func (f *DHCPLeaseGuestLookup) GuestIP() (string, error) {
|
|||
// If the mac address matches and this lease ends farther in the
|
||||
// future than the last match we might have, then choose it.
|
||||
matches = macLineRe.FindStringSubmatch(line)
|
||||
if matches != nil && matches[1] == f.MACAddress && curLeaseEnd.Before(lastLeaseEnd) {
|
||||
if matches != nil && strings.EqualFold(matches[1], f.MACAddress) && curLeaseEnd.Before(lastLeaseEnd) {
|
||||
curIp = lastIp
|
||||
curLeaseEnd = lastLeaseEnd
|
||||
}
|
||||
}
|
||||
|
||||
if curIp == "" {
|
||||
return "", errors.New("IP not found for MAC in DHCP leases")
|
||||
return "", fmt.Errorf("IP not found for MAC %s in DHCP leases at %s", f.MACAddress, dhcpLeasesPath)
|
||||
}
|
||||
|
||||
return curIp, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue