]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5137] Command parameters added
authorTomek Mrugalski <tomasz@isc.org>
Mon, 6 Mar 2017 19:00:35 +0000 (20:00 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 6 Mar 2017 19:00:35 +0000 (20:00 +0100)
src/bin/shell/kea-shell
src/bin/shell/kea_conn.py

index 62fccfcc092e13cab5e06b0c0ed714a1b0db12e2..b24d4a61bdb001b8efafc08b82ae9041a5a6a967 100644 (file)
@@ -50,6 +50,13 @@ params.generateHeaders()
 
 conn = kea_connector.KeaConnector()
 
+# Load command processor
+# @todo
+
+# Read parameters from stdin (they're optional for some commands)
+for line in sys.stdin:
+    params.params += line
+
 try:
     resp = conn.sendCA(params)
 except Exception as e:
index c1fb2dc5aa412ca5f15da9c17e5f73c851345217..d7791469c7436ab4eae995f2affdd109bf75d2f5 100644 (file)
@@ -16,6 +16,7 @@ class CARequest:
     http_port = 0
     command = ''
     timeout = 0
+    params = ''
     headers = {}
 
     # Generates the content, out of specified command line
@@ -23,7 +24,10 @@ class CARequest:
     # @todo: Add support for parameters
     # this stores the output in self.content
     def generateBody(self):
-        self.content = '{"command": "' + self.command + '"}'
+        self.content = '{ "command": "' + self.command + '" '
+        if (len(self.params)):
+            self.content += self.params
+        self.content += '}'
 
     # Generate HTTP headers
     #