mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-02-12 19:22:30 +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({})))
|
||||
|
||||
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):
|
||||
return self.db[self.collection_clusters].update({"vmid": str(cluster)}, {'$set': data}, upsert=False)
|
||||
|
|
Loading…
Reference in a new issue