Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-stable
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
emulab
emulab-stable
Commits
df2b09b3
Commit
df2b09b3
authored
Mar 17, 2004
by
Leigh Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version that people can probably play with safely, I think.
parent
d8fad8b2
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
466 additions
and
123 deletions
+466
-123
GNUmakefile.in
GNUmakefile.in
+2
-1
configure
configure
+3
-1
configure.in
configure.in
+3
-1
xmlrpc/GNUmakefile.in
xmlrpc/GNUmakefile.in
+20
-13
xmlrpc/emulabclient.py.in
xmlrpc/emulabclient.py.in
+15
-9
xmlrpc/emulabserver.py.in
xmlrpc/emulabserver.py.in
+100
-54
xmlrpc/experiment.in
xmlrpc/experiment.in
+5
-0
xmlrpc/sshxmlrpc.py
xmlrpc/sshxmlrpc.py
+9
-4
xmlrpc/sshxmlrpc_client.py.in
xmlrpc/sshxmlrpc_client.py.in
+13
-6
xmlrpc/xmlrpcapi.php3
xmlrpc/xmlrpcapi.php3
+296
-34
No files found.
GNUmakefile.in
View file @
df2b09b3
...
...
@@ -22,7 +22,7 @@ include Makeconf
#
SUBDIRS = lib db assign @optional_subdirs@ ipod security sensors \
pxe tbsetup account tmcd utils www tip capture ipod vis \
sensors os install/newnode_sshkeys
sensors os
xmlrpc
install/newnode_sshkeys
all: all-subdirs
...
...
@@ -64,6 +64,7 @@ ops-install:
@$(MAKE) -C tbsetup control-install
@$(MAKE) -C utils control-install
@$(MAKE) -C event control-install
@$(MAKE) -C xmlrpc control-install
install-mkdirs:
-mkdir -p $(INSTALL_TOPDIR)/opsdir
...
...
configure
View file @
df2b09b3
...
...
@@ -1462,7 +1462,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
$eventfiles
\
$winfiles
\
apache/GNUmakefile apache/httpd.conf
\
xmlrpc/GNUmakefile
\
xmlrpc/GNUmakefile xmlrpc/emulabclient.py xmlrpc/emulabserver.py
\
xmlrpc/sshxmlrpc_client.py xmlrpc/sshxmlrpc_server.py
\
xmlrpc/webxmlrpc
\
install/ops-install install/boss-install
\
install/newnode_sshkeys/GNUmakefile "
...
...
configure.in
View file @
df2b09b3
...
...
@@ -507,7 +507,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
$eventfiles \
$winfiles \
apache/GNUmakefile apache/httpd.conf \
xmlrpc/GNUmakefile \
xmlrpc/GNUmakefile xmlrpc/emulabclient.py xmlrpc/emulabserver.py \
xmlrpc/sshxmlrpc_client.py xmlrpc/sshxmlrpc_server.py \
xmlrpc/webxmlrpc \
install/ops-install install/boss-install \
install/newnode_sshkeys/GNUmakefile "
...
...
xmlrpc/GNUmakefile.in
View file @
df2b09b3
...
...
@@ -17,24 +17,30 @@ SBIN_SCRIPTS = sshxmlrpc_server.py
LIB_STUFF = sshxmlrpc.py emulabserver.py emulabclient.py
LIBEXEC_STUFF = webxmlrpc
WWW_STUFF = xmlrpcapi.php3
DOWNLOAD_STUFF = sshxmlrpc.py sshxmlrpc_client.py emulabclient.py
DEBUG_STUFF = experiment
#
# These are the ones installed on plastic (users, control, etc).
#
USERBINS = sshxmlrpc_client.py
CLIENTBIN = sshxmlrpc_client.py
USERLIBS = sshxmlrpc.py emulabclient.py
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(BIN_SCRIPTS) $(SBIN_SCRIPTS) $(LIB_STUFF) $(LIBEXEC_STUFF)
all: $(BIN_SCRIPTS) $(SBIN_SCRIPTS) $(LIB_STUFF) $(LIBEXEC_STUFF) \
$(DOWNLOAD_STUFF) $(DEBUG_STUFF)
include $(TESTBED_SRCDIR)/GNUmakerules
install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_SCRIPTS)) \
$(addprefix $(INSTALL_SBINDIR)/, $(SBIN_SCRIPTS)) \
$(addprefix $(INSTALL_SBINDIR)/xmlrpc/, $(DEBUG_STUFF)) \
$(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_STUFF)) \
$(addprefix $(INSTALL_WWWDIR)/, $(WWW_STUFF)) \
$(addprefix $(INSTALL_WWWDIR)/downloads/xmlrpc/, $(DOWNLOAD_STUFF)) \
$(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF))
$(INSTALL_WWWDIR)/%: %
...
...
@@ -42,19 +48,20 @@ $(INSTALL_WWWDIR)/%: %
-mkdir -p $(patsubst %/,%,$(dir $@))
$(INSTALL_DATA) $(subst $$,\$$,$<) $(subst $$,\$$,$@)
$(INSTALL_WWWDIR)/downloads/xmlrpc/%: %
@echo "Installing $<"
-mkdir -p $(patsubst %/,%,$(dir $@))
$(INSTALL_DATA) $(subst $$,\$$,$<) $(subst $$,\$$,$@)
$(INSTALL_SBINDIR)/xmlrpc/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_SBINDIR)/xmlrpc
$(INSTALL_PROGRAM) $< $@
#
# Control node installation (okay, plastic)
#
ifneq ($(UNIFIED),1)
LINKS= cd $(INSTALL_BINDIR) && \
list='$(USERBINS)'; for file in $$list; do \
rm -f $$file; \
ln -s plasticwrap $$file; \
done;
endif
control-install:
$(LINKS)
control-install: $(addprefix $(INSTALL_LIBDIR)/, $(USERLIBS)) \
$(addprefix $(INSTALL_BINDIR)/, $(CLIENTBIN))
clean:
xmlrpc/emulabclient.py.in
View file @
df2b09b3
...
...
@@ -15,11 +15,17 @@ MAXNSFILESIZE = (1024 * 512)
#
# This class defines a simple structure to return back to the caller.
# It includes the exit status of the command, and any output that it
# wants to send back. Why not return a tuple? Well, it appears that the
# python xmlrpc library requires that a singleton be returned from the
# server, and I do not want to depend on the "Fault" structure that XML
# defines for return values.
# It includes a basic response code (success, failure, badargs, etc),
# as well as a return "value" which can be any valid datatype that can
# be represented in XML (int, string, hash, float, etc). You can also
# send back some output (a string with embedded newlines) to print out
# to the user.
#
# Why not return a tuple? Well, it appears that the python xmlrpc
# library requires that a singleton be returned from the server.
#
# Note that XMLRPC does not actually return a "class" to the caller; It gets
# converted to a hashed array (Python Dictionary).
#
RESPONSE_SUCCESS
=
0
RESPONSE_BADARGS
=
1
...
...
@@ -29,11 +35,11 @@ RESPONSE_BADVERSION = 4
RESPONSE_SERVERERROR
=
5
RESPONSE_TOOBIG
=
6
class
ResponseBlock
:
class
EmulabResponse
:
def
__init__
(
self
,
code
,
value
=
0
,
output
=
None
):
self
.
code
=
code
self
.
value
=
value
self
.
output
=
output
self
.
code
=
code
# A RESPONSE code
self
.
value
=
value
# A return value; any valid XML type.
self
.
output
=
output
# Pithy output to print
return
#
...
...
xmlrpc/emulabserver.py.in
View file @
df2b09b3
This diff is collapsed.
Click to expand it.
xmlrpc/experiment.in
0 → 100755
View file @
df2b09b3
#!/bin/sh
DIR
=
@prefix@/sbin/
exec
$DIR
/sshxmlrpc_server.py experiment
xmlrpc/sshxmlrpc.py
View file @
df2b09b3
...
...
@@ -172,9 +172,12 @@ class SSHTransport:
# @param verbose unused.
# @return The value returned
#
def
request
(
self
,
host
,
handler
,
request_body
,
verbose
=
0
):
def
request
(
self
,
host
,
handler
,
request_body
,
verbose
=
0
,
path
=
None
):
# Strip the leading slash in the handler, if there is one.
if
handler
.
startswith
(
'/'
):
if
path
:
handler
=
path
+
handler
pass
elif
handler
.
startswith
(
'/'
):
handler
=
handler
[
1
:]
pass
...
...
@@ -347,7 +350,7 @@ class SSHServerProxy:
# @param encoding Content encoding.
# @param verbose unused.
#
def
__init__
(
self
,
uri
,
transport
=
None
,
encoding
=
None
,
verbose
=
0
):
def
__init__
(
self
,
uri
,
transport
=
None
,
encoding
=
None
,
verbose
=
0
,
path
=
None
):
type
,
uri
=
urllib
.
splittype
(
uri
)
if
type
not
in
(
"ssh"
,
):
raise
IOError
,
"unsupported XML-RPC protocol"
...
...
@@ -362,6 +365,7 @@ class SSHServerProxy:
self
.
__encoding
=
encoding
self
.
__verbose
=
verbose
self
.
__path
=
path
return
##
...
...
@@ -379,7 +383,8 @@ class SSHServerProxy:
self
.
__host
,
self
.
__handler
,
request
,
verbose
=
self
.
__verbose
verbose
=
self
.
__verbose
,
path
=
self
.
__path
)
# ... ensure there was a valid reply.
...
...
xmlrpc/sshxmlrpc_client.py.in
View file @
df2b09b3
...
...
@@ -32,6 +32,10 @@ module = "experiment"
# Debugging output.
debug
=
0
# For admin people.
SERVER_PATH
=
"/usr/testbed/sbin/"
path
=
None
##
# Print the usage statement to stdout.
#
...
...
@@ -74,7 +78,7 @@ def do_method(server, method_and_args):
#
params
=
{}
for
param
in
method_and_args
:
plist
=
string
.
split
(
param
,
"="
)
plist
=
string
.
split
(
param
,
"="
,
1
)
if
len
(
plist
)
!=
2
:
print
"Parameters are of the form: param=value!"
return
-
1
...
...
@@ -89,7 +93,7 @@ def do_method(server, method_and_args):
response
=
apply
(
meth
,
meth_args
)
#
# Parse the Response, which is a Dictionary. See
ResponseBlock
in the
# Parse the Response, which is a Dictionary. See
EmulabResponse
in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
...
...
@@ -116,7 +120,7 @@ def do_method(server, method_and_args):
try
:
# Parse the options,
opts
,
req_args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"dhVs:l:"
,
"dhVs:l:
a
"
,
[
"help"
,
"version"
,
"server="
,
"login="
,
])
# ... act on them appropriately, and
for
opt
,
val
in
opts
:
...
...
@@ -137,9 +141,12 @@ try:
elif
opt
in
(
"-m"
,
"--module"
):
module
=
val
pass
elif
opt
in
(
"-d"
):
elif
opt
in
(
"-d"
,
"--debug"
):
debug
=
1
pass
elif
opt
in
(
"-a"
,
"--admin"
):
path
=
SERVER_PATH
pass
pass
pass
except
getopt
.
error
,
e
:
...
...
@@ -150,7 +157,7 @@ except getopt.error, e:
# Get a handle on the server,
server
=
SSHServerProxy
(
"ssh://"
+
login_id
+
"@"
+
xmlrpc_server
+
"/xmlrpc/"
+
module
)
"/xmlrpc/"
+
module
,
path
=
path
)
if
len
(
req_args
):
# Method and args are on the command line.
...
...
@@ -160,7 +167,7 @@ else:
try
:
while
True
:
line
=
raw_input
(
"$ "
)
tokens
=
line
.
split
(
" "
,
1
)
tokens
=
line
.
split
(
" "
)
if
len
(
tokens
)
>=
1
and
len
(
tokens
[
0
])
>
0
:
try
:
print
str
(
do_method
(
server
,
tokens
))
...
...
xmlrpc/xmlrpcapi.php3
View file @
df2b09b3
This diff is collapsed.
Click to expand 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