Browse Source

[5137] Comments improved

Tomek Mrugalski 8 years ago
parent
commit
5e03c7da8d
4 changed files with 12 additions and 4 deletions
  1. 1 0
      configure.ac
  2. 1 1
      src/bin/shell/kea-shell.in
  3. 4 2
      src/bin/shell/kea_connector2.py
  4. 6 1
      src/bin/shell/kea_connector3.py

+ 1 - 0
configure.ac

@@ -470,6 +470,7 @@ AC_ARG_ENABLE(shell, [AC_HELP_STRING([--enable-shell],
 
 if test "x$enable_shell" != xno ; then
 # If kea-shell is enabled, we really need python. 2.7 or anything newer will do.
+# We try to find 3.x first. If not found, we can do with 2.7.
   AM_PATH_PYTHON([3], [found="yes"], [found="no"])
   if test "x$found" = xno ; then
     AM_PATH_PYTHON([2.7])

+ 1 - 1
src/bin/shell/kea-shell.in

@@ -71,7 +71,7 @@ def shell_body():
         print(VERSION)
         exit(0)
 
-    # Ok, now time to put the parameters parsed into the structure to be
+    # Ok, now it's time to put the parameters parsed into the structure to be
     # used by the connection.
     params = CARequest()
     params.command = cmd_args.command

+ 4 - 2
src/bin/shell/kea_connector2.py

@@ -13,7 +13,9 @@ import httplib
 from kea_conn import CAResponse # CARequest
 
 def send_to_control_agent(params):
-    """Establish HTTP connection first."""
+    """ Sends a request to Control Agent, receives a response and returns it."""
+
+    # Establish HTTP connection first.
     conn = httplib.HTTPConnection(params.http_host, params.http_port)
     conn.connect()
 
@@ -25,7 +27,7 @@ def send_to_control_agent(params):
         conn.putheader(k, params.headers[k])
     conn.endheaders()
 
-    # Send the content
+    # Send the body (i.e. the actual content)
     conn.send(params.content)
 
     # Now get the response

+ 6 - 1
src/bin/shell/kea_connector3.py

@@ -13,13 +13,18 @@ import urllib.request
 from kea_conn import CAResponse # CARequest
 
 def send_to_control_agent(params):
-    """Establish HTTP connection first."""
+    """ Sends a request to Control Agent, receives a response and returns it."""
+
+    # First, create the URL
     url = "http://" + params.http_host + ":"
     url += str(params.http_port) + str(params.path)
 
+    # Now preprare the request (URL, headers and body)
     req = urllib.request.Request(url=url,
                                  data=str.encode(params.content),
                                  headers=params.headers)
+
+    # Establish connection, send the request.
     resp = urllib.request.urlopen(req)
 
     # Now get the response details, put it in CAResponse and return it