1
0
Fork 0
mirror of https://github.com/ThomasGsp/HyperProxmox.git synced 2025-02-15 04:32:15 +00:00

fix errors

This commit is contained in:
Tlams 2018-02-11 18:40:47 +00:00
parent 86b208f5e2
commit dade675fc0

View file

@ -129,7 +129,7 @@ class MongoDB:
try: try:
result = { result = {
"result": "OK", "result": "OK",
"value": self.db[self.collection_clusters].insert(data) "value": json.loads(dumps(self.db[self.collection_clusters].insert(data)))
} }
except BaseException as serr: except BaseException as serr:
@ -302,7 +302,6 @@ class MongoDB:
} }
return result return result
def get_instances(self, date, cluster, node, vmid): def get_instances(self, date, cluster, node, vmid):
try: try:
if not cluster: if not cluster:
@ -363,21 +362,21 @@ class MongoDB:
result = { result = {
"result": "OK", "result": "OK",
"value": json.loads(dumps( "value": json.loads(dumps(
self.db[self.collection_disks].find({"date": int(date)}))) self.db[self.collection_storages].find({"date": int(date)})))
} }
elif not node: elif not node:
result = { result = {
"result": "OK", "result": "OK",
"value": json.loads(dumps( "value": json.loads(dumps(
self.db[self.collection_disks].find( self.db[self.collection_storages].find(
{'$and': [{"date": int(date), "cluster": cluster}]}))) {'$and': [{"date": int(date), "cluster": cluster}]})))
} }
else: else:
result = { result = {
"result": "OK", "result": "OK",
"value": json.loads(dumps( "value": json.loads(dumps(
self.db[self.collection_disks].find_one( self.db[self.collection_storages].find(
{'$and': [{"date": int(date), "cluster": cluster, "node": node, "vmid": int(vmid)}]}))) {'$and': [{"date": int(date), "cluster": cluster, "node": node}]})))
} }
except BaseException as serr: except BaseException as serr:
result = { result = {