From c59d511ea31f1602c3bb492909b153389e50525f Mon Sep 17 00:00:00 2001 From: Cedric Verstraeten Date: Tue, 14 Feb 2023 22:55:18 +0100 Subject: [PATCH] fix for macs and ips --- machinery/src/cloud/Cloud.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/machinery/src/cloud/Cloud.go b/machinery/src/cloud/Cloud.go index 6dbc3e2..f147680 100644 --- a/machinery/src/cloud/Cloud.go +++ b/machinery/src/cloud/Cloud.go @@ -221,6 +221,10 @@ func HandleHeartBeat(configuration *models.Configuration, communication *models. isEnterprise = true } + // Congert to string + macs, _ := json.Marshal(system.MACs) + ips, _ := json.Marshal(system.IPs) + var object = fmt.Sprintf(`{ "key" : "%s", "version" : "3.0.0", @@ -235,8 +239,8 @@ func HandleHeartBeat(configuration *models.Configuration, communication *models. "totalMemory" : "%d", "usedMemory" : "%d", "freeMemory" : "%d", - "macs" : "%v", - "ips" : "%v", + "macs" : %s, + "ips" : %s, "board" : "", "disk1size" : "%s", "disk3size" : "%s", @@ -250,7 +254,7 @@ func HandleHeartBeat(configuration *models.Configuration, communication *models. "docker" : true, "kios" : false, "raspberrypi" : false - }`, config.Key, system.Version, system.CPUId, username, key, name, isEnterprise, system.Hostname, system.Architecture, system.TotalMemory, system.UsedMemory, system.FreeMemory, system.MACs, system.IPs, "0", "0", "0", uptimeString, config.HubSite, onvifEnabled) + }`, config.Key, system.Version, system.CPUId, username, key, name, isEnterprise, system.Hostname, system.Architecture, system.TotalMemory, system.UsedMemory, system.FreeMemory, ips, macs, "0", "0", "0", uptimeString, config.HubSite, onvifEnabled) var jsonStr = []byte(object) buffy := bytes.NewBuffer(jsonStr)