Maxi Schvindt 7 年之前
父节点
当前提交
a4e5e24c85
共有 2 个文件被更改,包括 13 次插入11 次删除
  1. 10 8
      src/KeaBundle/Services/BaseKea.php
  2. 3 3
      src/KeaBundle/Services/KeaConfigService.php

+ 10 - 8
src/KeaBundle/Services/BaseKea.php

@@ -36,14 +36,16 @@ class BaseKea implements KeaConfigInterface
         }
 
         return json_encode([
-            'Dhcp4' => [
-                'control-socket' => $this->controlSocketConfig(),
-                'lease-database' =>$this->leaseDatabaseConfig(),
-                'subnet4' => $this->subnet4,
-                'hooks-libraries' => $this->hooks_libraries,
-            ],
-            'Logging' => $this->loggingConfig(),
-        ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
+                array(
+                'arguments' => array(
+                    'Dhcp4' => [
+                        'control-socket' => $this->controlSocketConfig(),
+                        'lease-database' =>$this->leaseDatabaseConfig(),
+                        'subnet4' => $this->subnet4,
+                        'hooks-libraries' => $this->hooks_libraries,
+                    ],
+                    'Logging' => $this->loggingConfig(),
+            ))], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     }
 
     /**

+ 3 - 3
src/KeaBundle/Services/KeaConfigService.php

@@ -101,9 +101,9 @@ class KeaConfigService
 
         $_params = json_decode($params, true);
         $json = json_encode($_params);
-        
-        if(isset($_params['Dhcp4'])) {
-            $_params = array("command" => "config-set", "service" => array("dhcp4"), "arguments" => $_params);
+
+        if(isset($_params[0]) && isset($_params[0]['arguments'])) {
+            $_params = array("command" => "config-set", "service" => array("dhcp4"), "arguments" => $_params[0]['arguments']);
         } else {
             return json_encode(array("error" => "Config Error."));
         }