Skip to content

Commit

Permalink
mogfiledebug: do not require --domain for --fid
Browse files Browse the repository at this point in the history
Specifying a domain (even a valid, non-existent one) when one is
not needed hurts usability and confuses users.  Set a dummy
domain for MogileFS::Client if a domain is unspecified and --fid
is used.
  • Loading branch information
Eric Wong authored and dormando committed Jan 10, 2013
1 parent e5c1849 commit 6b036d6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mogfiledebug
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ use LWP::UserAgent;
my $util = MogileFS::Utils->new;
my $usage = qq{--trackers=host --domain=foo --key='/hello.jpg'
If FID is known, but domain/key are not known:
--trackers=host --domain=anything --fid=123456};
--trackers=host --fid=123456};
# FIXME: add "nofetch" mode that just prints paths?
my $c = $util->getopts($usage, qw/key=s fid=i/);

my $mogc = $util->client;
my $arg;
if ($c->{fid}) {
$c->{domain} ||= 'mogfiledebug-unset';
$arg = 'fid';
} else {
$arg = 'key';
}

my $arg = $c->{fid} ? 'fid' : 'key';
my $mogc = $util->client;
my $details = $mogc->file_debug($arg => $c->{$arg});
if ($mogc->errcode) {
die "Error fetching fid info: " . $mogc->errstr;
Expand Down

0 comments on commit 6b036d6

Please sign in to comment.