improve parser by skipping all lines containing a '{' or a '}'. fix unecessary []byte cast (linter issue).

This commit is contained in:
Pyrrvs 2020-12-14 01:00:24 +01:00
parent 7201ce9248
commit f0612e4688
2 changed files with 2 additions and 2 deletions

View File

@ -462,7 +462,7 @@ func (d *VmwareDriver) PotentialGuestIP(state multistep.StateBag) ([]string, err
available_lease_entries := make([]appleDhcpLeaseEntry, 0) available_lease_entries := make([]appleDhcpLeaseEntry, 0)
for _, entry := range leaseEntries { for _, entry := range leaseEntries {
// Next check for any where the hardware address matches. // Next check for any where the hardware address matches.
if bytes.Equal(hwaddr, []byte(entry.hwAddress)) { if bytes.Equal(hwaddr, entry.hwAddress) {
available_lease_entries = append(available_lease_entries, entry) available_lease_entries = append(available_lease_entries, entry)
} }
} }

View File

@ -2462,7 +2462,7 @@ func readAppleDhcpdLeaseEntry(in chan byte) (entry *appleDhcpLeaseEntry, err err
if !ok { if !ok {
insideBraces = false insideBraces = false
} }
if item_s == "{" || item_s == "}" { if strings.Contains(item_s, "{") || strings.Contains(item_s, "}") {
continue continue
} }
splittedLine := strings.Split(item_s, "=") splittedLine := strings.Split(item_s, "=")