mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-03-09 15:40:18 +00:00
Return correct error on insert_new_cluster.
Require to apply the same patch on all fct.
This commit is contained in:
parent
e4b14f520d
commit
ac4ec9d1fa
1 changed files with 7 additions and 1 deletions
|
@ -116,7 +116,13 @@ class MongoDB:
|
||||||
return json.loads(dumps(self.db[self.collection_clusters].find({})))
|
return json.loads(dumps(self.db[self.collection_clusters].find({})))
|
||||||
|
|
||||||
def insert_new_cluster(self, data):
|
def insert_new_cluster(self, data):
|
||||||
return self.db[self.collection_clusters].insert(data)
|
try:
|
||||||
|
self.db[self.collection_clusters].insert(data)
|
||||||
|
result = {"value": "{0} {1}".format(data["name"], "is now available")}
|
||||||
|
except BaseException as e:
|
||||||
|
result = {"value": "{0} {1}".format("Invalid request", e)}
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def update_cluster(self, cluster, data):
|
def update_cluster(self, cluster, data):
|
||||||
return self.db[self.collection_clusters].update({"vmid": str(cluster)}, {'$set': data}, upsert=False)
|
return self.db[self.collection_clusters].update({"vmid": str(cluster)}, {'$set': data}, upsert=False)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue