Commit 9aa974b0 authored by Timothy Stack's avatar Timothy Stack
Browse files

Add an experiment.nsfile method so you can get the nsfile for an

experiment.
parent 7539770a
...@@ -2313,6 +2313,52 @@ class experiment: ...@@ -2313,6 +2313,52 @@ class experiment:
value=result, value=result,
output="ok") output="ok")
#
# Return the nsfile for the experiment.
#
def nsfile(self, version, argdict):
if version != self.VERSION:
return EmulabResponse(RESPONSE_BADVERSION,
output="Client version mismatch!")
try:
checknologins()
pass
except NoLoginsError, e:
return EmulabResponse(RESPONSE_REFUSED, output=str(e))
# Check for valid arguments.
argerror = CheckRequiredArgs(argdict, ("proj", "exp"))
if (argerror):
return argerror
if not (re.match("^[-\w]*$", argdict["proj"]) and
re.match("^[-\w]*$", argdict["exp"])):
return EmulabResponse(RESPONSE_BADARGS,
output="Improperly formed proj/exp!")
#
# Check permission. This will check proj/exp for illegal chars.
#
permerror = CheckExptPermission(self.uid,
argdict["proj"], argdict["exp"])
if (permerror):
return permerror
dbres = DBQueryFatal(
"select nsfile from nsfiles where pid=%s and eid=%s",
(argdict["proj"], argdict["exp"]))
if len(dbres) == 0:
return EmulabResponse(RESPONSE_ERROR,
output="No such experiment!")
result = dbres[0][0]
return EmulabResponse(RESPONSE_SUCCESS,
value=result,
output="ok")
# #
# Control the event system. # Control the event system.
# #
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment