update
This commit is contained in:
@@ -158,9 +158,28 @@ class PowerManagementService
|
||||
"type" => "WEBMKS"
|
||||
])->json();
|
||||
if (!isset($response['error_type'])) {
|
||||
// vCenter returns "wss://<esxi-host>/ticket/<id>" — the esxi
|
||||
// host is only reachable through HAProxy's ?host= routing
|
||||
// (see config('vmware.console_nodes')), so split it out here.
|
||||
$esxiHost = parse_url((string) $response['ticket'], PHP_URL_HOST);
|
||||
$ticketId = basename(parse_url((string) $response['ticket'], PHP_URL_PATH));
|
||||
// Array access, not config('vmware.console_nodes.'.$esxiHost) —
|
||||
// IPs contain dots, which collide with Laravel's dot notation.
|
||||
$consoleHost = config('vmware.console_nodes')[$esxiHost] ?? null;
|
||||
|
||||
if (!$consoleHost) {
|
||||
return [
|
||||
'error' => true,
|
||||
'data' => "Không tìm thấy console node cho ESXi host: $esxiHost",
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'error' => false,
|
||||
'data' => $response['ticket']
|
||||
'data' => [
|
||||
'ticket' => $ticketId,
|
||||
'host' => $consoleHost,
|
||||
],
|
||||
];
|
||||
}
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user