From 14a6d2ecfd054a6c57938542bf01173c7d791279 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Mon, 6 Mar 2017 20:00:35 +0100 Subject: [PATCH] [5137] Command parameters added --- src/bin/shell/kea-shell | 7 +++++++ src/bin/shell/kea_conn.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bin/shell/kea-shell b/src/bin/shell/kea-shell index 62fccfcc09..b24d4a61bd 100644 --- a/src/bin/shell/kea-shell +++ b/src/bin/shell/kea-shell @@ -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: diff --git a/src/bin/shell/kea_conn.py b/src/bin/shell/kea_conn.py index c1fb2dc5aa..d7791469c7 100644 --- a/src/bin/shell/kea_conn.py +++ b/src/bin/shell/kea_conn.py @@ -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 # -- GitLab