mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-02-14 12:12:16 +00:00
Multiples fix
This commit is contained in:
parent
da97c0c0de
commit
cd7eaabde6
7 changed files with 18 additions and 16 deletions
11
README.md
11
README.md
|
@ -187,6 +187,7 @@ If you loose it, you must delete the keys, delete the different entries in the c
|
|||
``` bash
|
||||
# Minimum:
|
||||
curl -H -XPOST -d '{
|
||||
"name": "Cluster_name",
|
||||
"url":"proxmox.cluster.net",
|
||||
"port": "8006",
|
||||
"user": "user@pve",
|
||||
|
@ -196,10 +197,11 @@ curl -H -XPOST -d '{
|
|||
"exclude_nodes": [""],
|
||||
"groups" : [""],
|
||||
"weight": 1
|
||||
}' localhost:8080/api/v1/administration/cluster/Cluster_A
|
||||
}' localhost:8080/api/v1/administration/cluster
|
||||
|
||||
# Other example:
|
||||
curl -H -XPOST -d '{
|
||||
"name": "Cluster_name",
|
||||
"url":"proxmox.cluster.net",
|
||||
"port": "8006",
|
||||
"user": "user@pve",
|
||||
|
@ -209,7 +211,7 @@ curl -H -XPOST -d '{
|
|||
"exclude_nodes": ["node_shit1"],
|
||||
"groups" : ["group1", "group2..."],
|
||||
"weight": 1
|
||||
}' localhost:8080/api/v1/administration/cluster/Cluster_B*
|
||||
}' localhost:8080/api/v1/administration/cluster
|
||||
|
||||
```
|
||||
|
||||
|
@ -245,9 +247,10 @@ curl -H -XPOST -d '{
|
|||
'/api/v1/administration/cluster/<cluster>' | GET - Return the informations for an specific cluster
|
||||
| PUT - Update the configurations for an specific cluster
|
||||
| DELETE - Delete the configuration for an specific cluster
|
||||
| POST - Insert a new cluster
|
||||
|
||||
'/api/v1/administration/cluster/' | GET - Return all clusters information
|
||||
|
||||
'/api/v1/administration/cluster' | GET - Return all clusters information
|
||||
| POST - Insert a new cluster
|
||||
```
|
||||
|
||||
### Data
|
||||
|
|
|
@ -87,16 +87,15 @@ class Cluster:
|
|||
|
||||
return json.dumps(result)
|
||||
|
||||
def POST(self, cluster):
|
||||
def POST(self):
|
||||
try:
|
||||
data = json.loads(web.data().decode('utf-8'))
|
||||
data["name"] = cluster
|
||||
result = core.insert_clusters_conf(data)
|
||||
except BaseException as e:
|
||||
result = {
|
||||
"result": "ERROR",
|
||||
"type": "PYTHON - API",
|
||||
"value": "Invalid request: {0}".format(e)
|
||||
"value": "Invalid insert request: {0}".format(e)
|
||||
}
|
||||
return result
|
||||
|
||||
|
@ -108,7 +107,7 @@ class Cluster:
|
|||
result = {
|
||||
"result": "ERROR",
|
||||
"type": "PYTHON - API",
|
||||
"value": "Invalid request: {0}".format(e)
|
||||
"value": "Invalid update request: {0}".format(e)
|
||||
}
|
||||
return result
|
||||
|
||||
|
@ -119,7 +118,7 @@ class Cluster:
|
|||
result = {
|
||||
"result": "ERROR",
|
||||
"type": "PYTHON - API",
|
||||
"value": "Invalid request: {0}".format(e)
|
||||
"value": "Invalid delete request: {0}".format(e)
|
||||
}
|
||||
return result
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ class Core:
|
|||
|
||||
cache = self.redis_cache.get_message(hash_hex)
|
||||
|
||||
if cache is None or self.generalconf["logger"]["debug"] == True:
|
||||
if cache is None or self.generalconf["logger"]["logs_level"] == 5:
|
||||
clusters_informations = self.mongo.get_clusters_conf(cluster)
|
||||
self.redis_cache.insert_message(hash_hex, clusters_informations, 500)
|
||||
return clusters_informations
|
||||
|
@ -441,7 +441,7 @@ class Core:
|
|||
}
|
||||
else:
|
||||
new_cluster = {
|
||||
"value": "{1} {0}".format(testdata, "Invalid or miss parametrer"),
|
||||
"value": "{1} {0}".format(testdata, "Invalid or missing parameter"),
|
||||
"result": "ERROR",
|
||||
"type": "PROXMOX - VALUES"
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ class Analyse:
|
|||
instance["uniqid"] = getidfromdesc.group(1)
|
||||
if getidfromdesc.group(1) in idlist:
|
||||
self.logger.write(
|
||||
{"result": "WARNING", "type": "HYPERPROXMOX", "value": "Double ID detected: {0}".format(getidfromdesc.group(1))})
|
||||
{"thread":threading.get_ident(), "result": "WARNING", "type": "HYPERPROXMOX", "value": "Double ID detected: {0}".format(getidfromdesc.group(1))})
|
||||
self.logger.write({"thread":threading.get_ident(), "result": "WARNING", "type": "HYPERPROXMOX", "value": json.dumps(instance)})
|
||||
self.logger.write({"thread":threading.get_ident(), "result": "WARNING", "type": "HYPERPROXMOX", "value": "-------------------"})
|
||||
else:
|
||||
|
|
|
@ -216,7 +216,7 @@ class MongoDB:
|
|||
|
||||
def update_clusters_conf(self, cluster, data):
|
||||
try:
|
||||
self.db[self.collection_clusters_conf].update({"vmid": str(cluster)}, {'$set': data}, upsert=False)
|
||||
self.db[self.collection_clusters_conf].update({"name": str(cluster)}, {'$set': data}, upsert=False)
|
||||
result = {
|
||||
"result": "OK",
|
||||
"value": "{0} has been updated".format(data["name"])
|
||||
|
|
|
@ -115,7 +115,7 @@ if __name__ == "__main__":
|
|||
# MANAGEMENT CLUSTER
|
||||
'/api/v1/administration/cluster/(?:[0-9a-zA-Z\_\-]+)', 'Cluster',
|
||||
'/api/v1/administration/cluster/', 'Cluster',
|
||||
# '/api/v1/administration/cluster/new', 'Cluster',
|
||||
'/api/v1/administration/cluster', 'Cluster',
|
||||
|
||||
# PURGE SYSTEM
|
||||
'/api/v1/administration/purge', 'Purge',
|
||||
|
|
|
@ -27,7 +27,7 @@ class API_GET_INFO
|
|||
if (!empty($cluster))
|
||||
$cluster_conf = curl("api/v1/administration/cluster/".$cluster);
|
||||
else
|
||||
$cluster_conf = curl("api/v1/administration/cluster/");
|
||||
$cluster_conf = curl("api/v1/administration/cluster");
|
||||
return $cluster_conf;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class API_GET_INFO
|
|||
|
||||
public function GET_Groups()
|
||||
{
|
||||
$groups = curl("api/v1/administration/cluster/");
|
||||
$groups = curl("api/v1/administration/cluster");
|
||||
return $groups;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue