From 9b2d219cabd7de04d28be3aa5e1a0b61020da2e1 Mon Sep 17 00:00:00 2001 From: Marc O'Morain Date: Wed, 18 Mar 2015 16:40:05 +0000 Subject: [PATCH] MAC address can be upper or lower case --- builder/vmware/common/guest_ip.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builder/vmware/common/guest_ip.go b/builder/vmware/common/guest_ip.go index ad345d435..25ca3b795 100644 --- a/builder/vmware/common/guest_ip.go +++ b/builder/vmware/common/guest_ip.go @@ -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