The-Network-Crew/Proxmox-VE-for-WHMCS

VM/CT Actions: Improve handling, move from boolean return to "success" or exception

Closed this issue · 2 comments

Relates to #23
Relates to #25

There is some code for this already, same under each action:

$response_message = json_encode($proxmox['data']['errors']);
return "Error performing action. " . $response_message;

However, a test shows that starting a running VM shows COMPLETED but Proxmox actually returned error.

So we need to change from if-fired-command-then-OK to if-command-returned-as-expected-then-OK.

if ($proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/start' , $pve_cmdparam))
			return "success" ;

Pending refinement, this has been overhauled and works well - just about exception criteria but framework done.