[tahoe-dev] [tahoe-lafs] #939: 'tahoe ls': fail gracefully when tahoe: doesn't exist and no alias is specified

tahoe-lafs trac at allmydata.org
Sun Feb 7 20:00:01 UTC 2010


#939: 'tahoe ls': fail gracefully when tahoe: doesn't exist and no alias is
specified
-------------------------------+--------------------------------------------
 Reporter:  kevan              |           Owner:           
     Type:  defect             |          Status:  new      
 Priority:  major              |       Milestone:  undecided
Component:  code-frontend-cli  |         Version:  1.6.0    
 Keywords:                     |   Launchpad_bug:           
-------------------------------+--------------------------------------------
 When I do 'tahoe ls' on a fresh node, I get

 {{{
 kevan at b8chem-87:~$ tahoe ls
 Traceback (most recent call last):
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/support/bin/tahoe", line 8, in <module>
     load_entry_point('allmydata-tahoe==1.6.0', 'console_scripts',
 'tahoe')()
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/runner.py", line 102, in run
     rc = runner(sys.argv[1:])
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/runner.py", line 89, in runner
     rc = cli.dispatch[command](so)
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/cli.py", line 429, in list
     rc = tahoe_ls.list(options)
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/tahoe_ls.py", line 18, in list
     rootcap, path = get_alias(aliases, where, DEFAULT_ALIAS)
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/common.py", line 150, in get_alias
     return aliases[default], path
 KeyError: 'tahoe'
 kevan at b8chem-87:~$
 }}}

 If I create an alias, then try again, I get

 {{{
 kevan at b8chem-87:~$ tahoe create-alias havasu
 Alias 'havasu' created
 kevan at b8chem-87:~$ tahoe ls
 Traceback (most recent call last):
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/support/bin/tahoe", line 8, in <module>
     load_entry_point('allmydata-tahoe==1.6.0', 'console_scripts',
 'tahoe')()
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/runner.py", line 102, in run
     rc = runner(sys.argv[1:])
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/runner.py", line 89, in runner
     rc = cli.dispatch[command](so)
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/cli.py", line 429, in list
     rc = tahoe_ls.list(options)
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/tahoe_ls.py", line 18, in list
     rootcap, path = get_alias(aliases, where, DEFAULT_ALIAS)
   File "/home/kevan/Desktop/software/tahoe/allmydata-
 tahoe-1.6.0/src/allmydata/scripts/common.py", line 150, in get_alias
     return aliases[default], path
 KeyError: 'tahoe'
 kevan at b8chem-87:~$
 }}}

 I should probably see something like
 {{{
 kevan at b8chem-87:~$ tahoe ls
 Usage:  tahoe <command> [command options] ls [options]
 Options:
   -q, --quiet             Operate silently.
   -V, --version           Display version numbers and exit.
       --version-and-path  Display version numbers and paths to their
 locations
                           and exit.
   -l, --long              Use long format: show file sizes, and timestamps
       --uri               Show file/directory URIs
       --readonly-uri      Show readonly file/directory URIs
   -F, --classify          Append '/' to directory names, and '*' to
 mutable
       --json              Show the raw JSON output
   -d, --node-directory=   Look here to find out which Tahoe node should be
 used
                           for all operations. The directory should either
                           contain a full Tahoe node, or a file named
 node.url
                           which points to some other Tahoe node. It should
 also
                           contain a file named private/aliases which
 contains
                           the mapping from alias name to root dirnode URI.
                           [default: ~/.tahoe]
   -u, --node-url=         URL of the tahoe node to use, a URL like
                           "http://127.0.0.1:3456". This overrides the URL
 found
                           in the --node-directory .
       --dir-cap=          Which dirnode URI should be used as the 'tahoe'
 alias.
       --help              Display this help and exit.

 List the contents of some portion of the grid.

 error: no alias specified, and the default 'tahoe' alias doesn't exist.
 kevan at b8chem-87:~$
 }}}

 or, perhaps better still, the CLI code could look in
 ~/.tahoe/private/aliases and choose one of those instead of requiring the
 'tahoe' alias (failing gracefully with something like the message above if
 nothing is there, of course).

-- 
Ticket URL: <http://allmydata.org/trac/tahoe/ticket/939>
tahoe-lafs <http://allmydata.org>
secure decentralized file storage grid


More information about the tahoe-dev mailing list