add failure path to approveResources if there was an error retrieving pool state from proxmox or fabric

This commit is contained in:
2026-06-10 16:43:03 +00:00
parent f64c8899fe
commit 132e25b7f2
3 changed files with 12 additions and 3 deletions
+4 -1
View File
@@ -254,7 +254,10 @@ export default class PVE extends PVE_BACKEND {
// only add type if it is vm or ct (ie has vmid)
if (resource.vmid) {
const instance = await this.getInstance(resource.node, resource.vmid);
if (instance) {
if (instance === null) {
return null;
}
else {
instance.node = resource.node;
resources[resource.vmid] = instance;
}
-2
View File
@@ -337,8 +337,6 @@ router.post("/:disk/create", async (req, res) => {
iso: req.body.iso
};
console.log(req.cookies)
// attempt to parse user from username
const userObj = global.utils.getUserObjFromUsername(req.cookies.username);
if (userObj == null) {
+8
View File
@@ -123,6 +123,9 @@ export async function getPoolResources (req, pool) {
}
const configs = await global.pve.getPoolResources(req.cookies, pool);
if (configs === null) {
return null;
}
for (const vmid in configs) {
const config = configs[vmid];
@@ -232,6 +235,11 @@ export async function approveResources (req, user, node, pool, request) {
const poolResources = await getPoolResources(req, pool);
const reason = {};
if (poolResources === null) {
reason["server"] = "error in retrieving pool resource state";
return {approved: false, reason};
}
for (const key in request) {
// if requested resource is not specified in user resources, assume it's not allowed
if (!(key in poolResources)) {