diff --git a/src/DhcpBundle/Controller/DhcpController.php b/src/DhcpBundle/Controller/DhcpController.php index 5201251..a65e318 100644 --- a/src/DhcpBundle/Controller/DhcpController.php +++ b/src/DhcpBundle/Controller/DhcpController.php @@ -140,7 +140,7 @@ class DhcpController $output = shell_exec("df -h " . realpath($this->backup_dir) . " | tail -1 | awk '{print $2, $3, $4, $5}'"); if (!$output) { $this->logger->error("Failed to execute disk usage command"); - return null; + return []; } list($total, $used, $available, $percentage) = explode(' ', $output); @@ -217,6 +217,8 @@ class DhcpController * @OA\Property(property="subnet", type="string", description="The name of the subnet"), * @OA\Property(property="next-server", type="string", description="The next server in the subnet"), * @OA\Property(property="boot-file-name", type="string", description="The boot file name for the subnet"), + * @OA\Property(property="DNS", type="string", description="DNS subnet"), + * @OA\Property(property="subnetName", type="string", description="subnetName subnet"), * @OA\Property( * property="reservations", * type="array", @@ -395,7 +397,7 @@ class DhcpController * @OA\Property(property="mask", type="string", example="255.255.255.0"), * @OA\Property(property="address", type="string", example="192.168.1.0"), * @OA\Property(property="nextServer", type="string", example="192.168.1.1"), - * @OA\Property(property="subnetName", type="string", example="Aula informatica), + * @OA\Property(property="subnetName", type="string", example="Aula informatica"), * @OA\Property(property="DNS", type="string", example="192.168.1.1"), * @OA\Property(property="bootFileName", type="string", example="pxelinux.0"), * @OA\Property(property="router", type="string", example="192.168.1.254") @@ -521,7 +523,7 @@ public function addDhcpSubnet(Request $request): JsonResponse if (!empty($DNS)) { $newSubnet["option-data"][] = [ "name" => "domain-name-servers", - "code" => 23, + "code" => 6, "space" => "dhcp4", "csv-format" => true, "data" => $DNS @@ -888,8 +890,8 @@ public function addDhcpSubnet(Request $request): JsonResponse * type="object", * @OA\Property(property="mask", type="string"), * @OA\Property(property="address", type="string"), - * @OA\Property(property="DNS", type="string") - * @OA\Property(property="subnetName", type="string") + * @OA\Property(property="DNS", type="string"), + * @OA\Property(property="subnetName", type="string"), * @OA\Property(property="router", type="string", example="192.168.1.254"), * @OA\Property(property="nextServer", type="string"), * @OA\Property(property="bootFileName", type="string") @@ -2008,6 +2010,8 @@ public function updateDhcpHost(Request $request, $subnetId): JsonResponse ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); return new JsonResponse(['error' => $errorText], Response::HTTP_INTERNAL_SERVER_ERROR); } + + return new JsonResponse(['error' => 'Unexpected error occurred'], Response::HTTP_INTERNAL_SERVER_ERROR); }