Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
5e03c7da
Commit
5e03c7da
authored
Mar 09, 2017
by
Tomek Mrugalski
🛰
Browse files
[5137] Comments improved
parent
f0494b21
Changes
4
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
5e03c7da
...
...
@@ -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])
...
...
src/bin/shell/kea-shell.in
View file @
5e03c7da
...
...
@@ -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
...
...
src/bin/shell/kea_connector2.py
View file @
5e03c7da
...
...
@@ -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
...
...
src/bin/shell/kea_connector3.py
View file @
5e03c7da
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment