#945 closed defect (duplicate)
KeyError if default alias is not present.
| Reported by: | jdn | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.6.1 |
| Component: | code-frontend-cli | Version: | 1.6.0 |
| Keywords: | usability error | Cc: | |
| Launchpad Bug: |
Description
I noticed that when I issue the command:
tahoe stats -d storage/
(notice the missing alias) I get this KeyError?:
Traceback (most recent call last):
File "allmydata-tahoe-1.6.0/support/bin/tahoe", line 8, in <module>
load_entry_point('allmydata-tahoe==1.6.0', 'console_scripts', 'tahoe')()
File "allmydata-tahoe-1.6.0/src/allmydata/scripts/runner.py", line 102, in run
rc = runner(sys.argv[1:])
File "allmydata-tahoe-1.6.0/src/allmydata/scripts/runner.py", line 89, in runner
rc = cli.dispatch[command](so)
File "allmydata-tahoe-1.6.0/src/allmydata/scripts/cli.py", line 488, in stats
rc = tahoe_manifest.stats(options)
File "allmydata-tahoe-1.6.0/src/allmydata/scripts/tahoe_manifest.py", line 140, in stats
return StatsGrabber().run(options)
File "allmydata-tahoe-1.6.0/src/allmydata/scripts/slow_operation.py", line 20, in run
rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
File "allmydata-tahoe-1.6.0/src/allmydata/scripts/common.py", line 150, in get_alias
return aliases[default], path
KeyError: 'tahoe'
I guess it is because the default alias "tahoe" is not defined, thus I have made the attached patch of src/scripts/common.py. The patch raises an UnknowAliasError? instead of the KeyError?.
149a150,151
> if default not in aliases:
> raise UnknownAliasError("Unknown default alias '%s', please create it with 'tahoe add-alias' or 'tahoe create-alias'." % default)
I am not sure that the message is as one would like.
Attachments (1)
Change History (4)
Changed at 2010-02-11T14:08:05Z by jdn
comment:1 Changed at 2010-02-12T03:00:22Z by davidsarah
- Milestone changed from undecided to 1.7.0
- Priority changed from trivial to major
- Resolution set to duplicate
- Status changed from new to closed
comment:2 Changed at 2010-02-12T03:01:08Z by davidsarah
- Keywords error added; reliability removed
comment:3 Changed at 2010-02-15T18:49:01Z by davidsarah
- Milestone changed from 1.7.0 to 1.6.1
Note: See
TracTickets for help on using
tickets.

Duplicate of #939, which has a more complete fix.