mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-03-09 15:40:18 +00:00
insert check duplicate cluster
This commit is contained in:
parent
ac4ec9d1fa
commit
a47d251612
1 changed files with 10 additions and 4 deletions
|
@ -305,12 +305,18 @@ class Core:
|
||||||
|
|
||||||
def insert_cluster(self, data):
|
def insert_cluster(self, data):
|
||||||
testdata = valid_cluster_data(data)
|
testdata = valid_cluster_data(data)
|
||||||
|
|
||||||
if not testdata:
|
if not testdata:
|
||||||
data["user"] = base64.b64encode(pcrypt(data["user"], self.generalconf["keys"]["key_pvt"])["data"]).decode('utf-8')
|
if not self.mongo.get_clusters_conf(data["name"]):
|
||||||
data["password"] = base64.b64encode(pcrypt(data["password"], self.generalconf["keys"]["key_pvt"])["data"]).decode('utf-8')
|
data["user"] = base64.b64encode(pcrypt(data["user"], self.generalconf["keys"]["key_pvt"])["data"]).decode('utf-8')
|
||||||
new_cluster = self.mongo.insert_new_cluster(data)
|
data["password"] = base64.b64encode(pcrypt(data["password"], self.generalconf["keys"]["key_pvt"])["data"]).decode('utf-8')
|
||||||
|
new_cluster = self.mongo.insert_new_cluster(data)
|
||||||
|
else:
|
||||||
|
new_cluster = {"value": "{0}".format("Duplicate entry, please delete the current cluster or update it")}
|
||||||
else:
|
else:
|
||||||
new_cluster = {"error": "{1} {0}".format(testdata, "Invalid or miss paramettrer")}
|
new_cluster = {"value": "{1} {0}".format(testdata, "Invalid or miss paramettrer")}
|
||||||
|
|
||||||
|
|
||||||
return new_cluster
|
return new_cluster
|
||||||
|
|
||||||
def change_cluster(self, cluster, data):
|
def change_cluster(self, cluster, data):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue