hack to work around compound object json
This commit is contained in:
+8
-4
@@ -7,6 +7,7 @@ the websit's heartbeat.py
|
||||
|
||||
import time
|
||||
import json
|
||||
import copy
|
||||
|
||||
num = 0
|
||||
|
||||
@@ -118,6 +119,9 @@ class Host:
|
||||
def __init__(self, name):
|
||||
global num
|
||||
self.name = name
|
||||
if name:
|
||||
num += 1
|
||||
Host.hosts[name] = self
|
||||
self.num = num
|
||||
self.dyn = False
|
||||
self.upcount = 0
|
||||
@@ -127,9 +131,6 @@ class Host:
|
||||
self.cver = 0
|
||||
self.connections = {}
|
||||
self.hdwcounts = [[0,0],[0,0],[0,0]]
|
||||
if name:
|
||||
num += 1
|
||||
Host.hosts[name] = self
|
||||
|
||||
|
||||
def statedict(self):
|
||||
@@ -169,7 +170,10 @@ class Host:
|
||||
if d == 'connections':
|
||||
cl = []
|
||||
for c in self.connections:
|
||||
cl.append(self.connections[c].__dict__)
|
||||
# dirty ugly hack: fix conn to host backpointer
|
||||
cld = copy.deepcopy(self.connections[c].__dict__)
|
||||
cld['host'] = cld['host'].name
|
||||
cl.append(cld)
|
||||
ddict[d] = cl
|
||||
else:
|
||||
ddict[d] = self.__dict__[d]
|
||||
|
||||
Reference in New Issue
Block a user