Open naja7host opened 9 years ago
The workaround for this is to add such arguments to the query string:
$pve2->get("/cluster/resources?type=vm");
$pve2->get("/nodes/localhost/storage/local/content?content=vztmpl");
$pve2->get("/nodes/localhost/bootlog?limit=3&start=5");
$pve2->get("/nodes/localhost/rrd?cf=average");
But yes, this should be handled internally.
@CpuID - Want me to tackle this one, or do you have it covered?
My gut feeling is just appending to the ->get() call first parameter makes sense here? I can understand the elegance of having it natively supported for example as a second optional array parameter to function get (), but it feels like it may blow out logic wise...? Chances are the only thing you would do within the get() function is append to action_path before sending to ->action() anyway...?
@danhunsaker - I'll let you tackle it if you like :)
make it as the put function , in my own script , i just used the same logic of put postfields before sending the request .
any way if is implemented it will be a good option .
@naja7host, @CpuID - I've submitted a PR for this (#12) if you would be willing to check it out. I'll merge it in a few days if there's no feedback suggesting otherwise.
i have tested it , work like a charm :)
edit : not working the paramaitre
it not working , because the class send the first request $action_path before the the switch case .
so the get parametre is set later , and it should build with the $action_path before it sended .
moving the line to the end of switch case , do the trick .
curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json{$action_path}");
is still not working , any one tested the optional settings in GET request ?
some GET request support additional setting , but in the class no support for this .
GET exemple with additional setting
pvesh get /cluster/resources -type vm pvesh get /nodes/localhost/storage/local/content -content vztmpl pvesh get /nodes/localhost/bootlog -limit 3 -start 5 pvesh get /nodes/localhost/rrd -cf average