update readme with new permissions required for proxmox 8,

improve handling of proxmox responses
This commit is contained in:
Arthur Lu 2024-07-01 19:03:36 +00:00
parent c63690c181
commit c8404c366f
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ In Proxmox VE, follow the following steps:
- Datastore.Allocate, Datastore.AllocateSpace, Datastore.Audit
- User.Modify
- Pool.Audit
- SDN.Use (if instances use SDN networks)
4. Add a new API Token Permission with path: `/`, select the API token created previously, and role: `proxmoxaas-api`
5. Add a new User Permission with path: `/`, select the `proxmoxaas-api` user, and role: `proxmoxaas-api`

View File

@ -91,7 +91,11 @@ export default class PVE extends PVE_BACKEND {
*/
async handleResponse (node, result, res) {
const waitFor = delay => new Promise(resolve => setTimeout(resolve, delay));
if (result.data.data && typeof (result.data.data) === "string" && result.data.data.startsWith("UPID:")) {
if (result.status !== 200) {
res.status(result.status).send({error: result.statusText});
res.end();
}
else if (result.data.data && typeof (result.data.data) === "string" && result.data.data.startsWith("UPID:")) {
const upid = result.data.data;
let taskStatus = await this.requestPVE(`/nodes/${node}/tasks/${upid}/status`, "GET", { token: true });
while (taskStatus.data.data.status !== "stopped") {