Skip to content
Browse files

mogfiledebug: do not require --domain for --fid

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...
1 parent e5c1849 commit 6b036d66529be92af583f8559b5eb748105c5ff6 Eric Wong committed with dormando
Showing with 9 additions and 3 deletions.
  1. +9 −3 mogfiledebug
12 mogfiledebug
@@ -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;

0 comments on commit 6b036d6

Please sign in to comment.
Something went wrong with that request. Please try again.