command-line: remove the --vdrive option (it is now hardcoded to "global")

This commit is contained in:
Zooko O'Whielacronx 2007-08-23 13:27:00 -07:00
parent 9b4a0ffa30
commit 0c22044f7e
6 changed files with 19 additions and 30 deletions

View File

@ -7,9 +7,6 @@ NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
class VDriveOptions(BaseOptions, usage.Options):
optParameters = [
["vdrive", "d", "global",
"which virtual drive to use: 'global' or 'private'"],
["node-url", "u", None,
"URL of the tahoe node to use, a URL like \"http://127.0.0.1:8888\""],
]
@ -66,7 +63,6 @@ subCommands = [
def list(config, stdout, stderr):
from allmydata.scripts import tahoe_ls
rc = tahoe_ls.list(config['node-url'],
config['vdrive'],
config['vdrive_pathname'])
return rc
@ -75,7 +71,6 @@ def get(config, stdout, stderr):
vdrive_filename = config['vdrive_filename']
local_filename = config['local_filename']
rc = tahoe_get.get(config['node-url'],
config['vdrive'],
vdrive_filename,
local_filename)
if rc == 0:
@ -98,7 +93,6 @@ def put(config, stdout, stderr):
else:
verbosity = 2
rc = tahoe_put.put(config['node-url'],
config['vdrive'],
local_filename,
vdrive_filename,
verbosity)
@ -112,7 +106,6 @@ def rm(config, stdout, stderr):
else:
verbosity = 2
rc = tahoe_rm.rm(config['node-url'],
config['vdrive'],
vdrive_pathname,
verbosity)
return rc

View File

@ -2,10 +2,10 @@
import sys, urllib
def get(nodeurl, vdrive, vdrive_fname, local_file):
def get(nodeurl, vdrive_fname, local_file):
if nodeurl[-1] != "/":
nodeurl += "/"
url = nodeurl + "vdrive/" + vdrive + "/"
url = nodeurl + "vdrive/global/"
if vdrive_fname:
url += vdrive_fname
@ -27,7 +27,6 @@ def get(nodeurl, vdrive, vdrive_fname, local_file):
def main():
import optparse, re
parser = optparse.OptionParser()
parser.add_option("-d", "--vdrive", dest="vdrive", default="global")
parser.add_option("-u", "--nodeurl", dest="nodeurl")
(options, args) = parser.parse_args()
@ -41,7 +40,7 @@ def main():
if len(args) > 1:
local_file = args[1]
get(options.nodeurl, options.vdrive, vdrive_fname, local_file)
get(options.nodeurl, vdrive_fname, local_file)
if __name__ == '__main__':
main()

View File

@ -3,10 +3,10 @@
import urllib
import simplejson
def list(nodeurl, vdrive, vdrive_pathname):
def list(nodeurl, vdrive_pathname):
if nodeurl[-1] != "/":
nodeurl += "/"
url = nodeurl + "vdrive/" + vdrive + "/"
url = nodeurl + "vdrive/global/"
if vdrive_pathname:
url += vdrive_pathname
url += "?t=json"
@ -31,7 +31,6 @@ def list(nodeurl, vdrive, vdrive_pathname):
def main():
import optparse, re
parser = optparse.OptionParser()
parser.add_option("-d", "--vdrive", dest="vdrive", default="global")
parser.add_option("-u", "--node-url", dest="nodeurl")
(options, args) = parser.parse_args()
@ -44,7 +43,7 @@ def main():
if args:
vdrive_pathname = args[0]
list(options.nodeurl, options.vdrive, vdrive_pathname)
list(options.nodeurl, vdrive_pathname)
if __name__ == '__main__':
main()

View File

@ -8,7 +8,7 @@ from twisted.internet import defer, reactor, protocol
SERVERURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
def _put(serverurl, vdrive, vdrive_fname, local_fname, verbosity):
def _put(serverurl, vdrive_fname, local_fname, verbosity):
"""
@param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose
@ -22,7 +22,7 @@ def _put(serverurl, vdrive, vdrive_fname, local_fname, verbosity):
d = defer.Deferred()
url = "/vdrive/" + vdrive + "/"
url = "/vdrive/global/"
if vdrive_fname:
url += vdrive_fname
@ -66,9 +66,9 @@ def _put(serverurl, vdrive, vdrive_fname, local_fname, verbosity):
if verbosity == 2:
if resp.code == 200:
outbuf.append("modified existing mapping in vdrive %s of name %s to point to " % (vdrive, vdrive_fname,))
outbuf.append("modified existing mapping of name %s to point to " % (vdrive_fname,))
elif resp.code == 201:
outbuf.append("created new mapping in vdrive %s of name %s to point to " % (vdrive, vdrive_fname,))
outbuf.append("created new mapping of name %s to point to " % (vdrive_fname,))
outbuf.append("URI: %s" % (uri,))
@ -86,7 +86,7 @@ def _put(serverurl, vdrive, vdrive_fname, local_fname, verbosity):
return d
def put(server, vdrive, vdrive_fname, local_fname, verbosity):
def put(server, vdrive_fname, local_fname, verbosity):
"""
This starts the reactor, does the PUT command, waits for the result, stops
the reactor, and returns the exit code.
@ -95,7 +95,7 @@ def put(server, vdrive, vdrive_fname, local_fname, verbosity):
@return: the exit code
"""
d = _put(server, vdrive, vdrive_fname, local_fname, verbosity)
d = _put(server, vdrive_fname, local_fname, verbosity)
exitcode = [ None ]
def exit(result):
exitcode[0] = result

View File

@ -4,7 +4,7 @@ import re, socket, sys
NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
def put(nodeurl, vdrive, local_fname, vdrive_fname, verbosity):
def put(nodeurl, local_fname, vdrive_fname, verbosity):
"""
@param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose
@ -14,7 +14,7 @@ def put(nodeurl, vdrive, local_fname, vdrive_fname, verbosity):
host = mo.group(1)
port = int(mo.group(3))
url = "/vdrive/" + vdrive + "/"
url = "/vdrive/global/"
if vdrive_fname:
url += vdrive_fname
@ -75,7 +75,6 @@ def put(nodeurl, vdrive, local_fname, vdrive_fname, verbosity):
def main():
import optparse, re
parser = optparse.OptionParser()
parser.add_option("-d", "--vdrive", dest="vdrive", default="global")
parser.add_option("-u", "--node-url", dest="nodeurl")
(options, args) = parser.parse_args()
@ -89,7 +88,7 @@ def main():
if len(args) > 1:
vdrive_fname = args[1]
return put(options.nodeurl, options.vdrive, vdrive_fname, local_file)
return put(options.nodeurl, vdrive_fname, local_file)
if __name__ == '__main__':
main()

View File

@ -4,7 +4,7 @@ import re, socket
NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
def rm(nodeurl, vdrive, vdrive_pathname, verbosity):
def rm(nodeurl, vdrive_pathname, verbosity):
"""
@param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose
@ -14,7 +14,7 @@ def rm(nodeurl, vdrive, vdrive_pathname, verbosity):
host = mo.group(1)
port = int(mo.group(3))
url = "/vdrive/" + vdrive + "/"
url = "/vdrive/global/"
if vdrive_pathname:
url += vdrive_pathname
@ -60,7 +60,6 @@ def rm(nodeurl, vdrive, vdrive_pathname, verbosity):
def main():
import optparse, re
parser = optparse.OptionParser()
parser.add_option("-d", "--vdrive", dest="vdrive", default="global")
parser.add_option("-u", "--node-url", dest="nodeurl")
(options, args) = parser.parse_args()
@ -71,7 +70,7 @@ def main():
vdrive_pathname = args[0]
return rm(options.nodeurl, options.vdrive, vdrive_pathname, 0)
return rm(options.nodeurl, vdrive_pathname, 0)
if __name__ == '__main__':
main()