2007-08-17 20:23:16 +00:00
|
|
|
|
2007-10-12 05:29:23 +00:00
|
|
|
import urllib
|
|
|
|
from allmydata.scripts.common_http import do_http
|
2007-08-17 20:23:16 +00:00
|
|
|
|
2008-01-04 00:02:05 +00:00
|
|
|
def rm(nodeurl, dir_uri, vdrive_pathname, verbosity, stdout, stderr):
|
2007-08-17 20:23:16 +00:00
|
|
|
"""
|
|
|
|
@param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose
|
|
|
|
|
|
|
|
@return: a Deferred which eventually fires with the exit code
|
|
|
|
"""
|
2007-10-12 05:29:23 +00:00
|
|
|
if nodeurl[-1] != "/":
|
|
|
|
nodeurl += "/"
|
2008-01-04 00:02:05 +00:00
|
|
|
url = nodeurl + "uri/%s/" % urllib.quote(dir_uri)
|
2007-08-17 20:23:16 +00:00
|
|
|
if vdrive_pathname:
|
2007-10-27 01:30:44 +00:00
|
|
|
url += urllib.quote(vdrive_pathname)
|
2007-08-17 20:23:16 +00:00
|
|
|
|
2007-10-12 05:29:23 +00:00
|
|
|
resp = do_http("DELETE", url)
|
2007-08-17 20:23:16 +00:00
|
|
|
|
2007-10-12 05:29:23 +00:00
|
|
|
if resp.status in (200,):
|
|
|
|
print >>stdout, "%s %s" % (resp.status, resp.reason)
|
|
|
|
return 0
|
2007-08-17 20:23:16 +00:00
|
|
|
|
2007-10-12 05:29:23 +00:00
|
|
|
print >>stderr, "error, got %s %s" % (resp.status, resp.reason)
|
|
|
|
print >>stderr, resp.read()
|
2007-08-17 20:23:16 +00:00
|
|
|
return 1
|