mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Merge pull request #95 from SiPearl/92-fix-failed-to-find-MAC-address-with-IP
#92 FindMACAddressWithIP expects Host IP without prefix, but is always true
This commit is contained in:
commit
de102ecc97
1 changed files with 7 additions and 2 deletions
|
|
@ -167,9 +167,14 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) ([]map[strin
|
|||
|
||||
// optionally, add the MACAddr property if we find a matching IP
|
||||
// from the correct ethernet interface
|
||||
mac, err := FindMACAddressWithIP(config, net.ParseIP(sr.Host))
|
||||
host := sr.Host
|
||||
str_protocol := "https://"
|
||||
if strings.Contains(host, str_protocol) {
|
||||
host = strings.TrimPrefix(sr.Host, str_protocol)
|
||||
}
|
||||
mac, err := FindMACAddressWithIP(config, net.ParseIP(host))
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msgf("failed to find MAC address with IP '%s'", sr.Host)
|
||||
log.Warn().Err(err).Msgf("failed to find MAC address with IP '%s'", host)
|
||||
}
|
||||
if mac != "" {
|
||||
data["MACAddr"] = mac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue