mogadm host modify...
Saunders, Newton
nsaunders at corp.untd.com
Mon Nov 13 22:59:00 UTC 2006
Hi,
I looked at Getopt::Long a bit more and I've found the problem. The
Getopt::Long configuration is fine, however, cmd_host_modify needs to
shift the $name from @ARGV instead of from the copy of @ARGV that is
passed in via $cmdsub->(@ARGV) .
sub cmd_host_modify {
- my $name = shift;
+ my $name = shift @ARGV;
cmd_help_die() unless $name;
...
}
The problem is that GetOptions operates directly on @ARGV, and with the
require_order and pass_through options enabled, "options processing will
terminate at the first unrecognized option, or non-option, whichever
comes first" (from the Perldoc). Unless we shift $name directly from
@ARGV, GetOptions will terminate on the hostname argument (in the call
"host modify hostname --status=alive").
It appears as though cmd_host_modify is the only command sub that
doesn't shift directly from @ARGV before calling GetOptions.
Regards,
Newton
-----Original Message-----
From: Brad Fitzpatrick [mailto:brad at danga.com]
Sent: Monday, November 13, 2006 2:50 PM
To: Saunders, Newton
Cc: mogilefs at lists.danga.com
Subject: Re: mogadm host modify...
I'm not sure that's entirely correct. I spent a bit of time yesterday
fighting this.
Basically we want strict argument checking both before the verb, and
after
the verb's options:
mogadm --someoptions verb modify --verb-options=foo --bogus-option
And have --bogus-option fail, as well as any bogus options before the
verb.
I wasn't able to figure it out quick enough and moved on. Do you know
how
to accomplish that?
I thought 'no_require_order' was the default? I'm wondering why we set
any Configure() options at all if the default was doing what we wanted.
On Mon, 13 Nov 2006, Saunders, Newton wrote:
> Hi,
>
>
>
> I just updated to the latest version of MogileFS in subversion and am
> having some trouble with the mogadm utility. I am unable to change a
> host's status or http_port. The following call does not cause an
error,
> however, it also does not modify the host:
>
>
>
> mogadm --trackers=<tracker_host>:<tracker_port> host modify
> <storage_node_host> --status=alive --port=22675
>
>
>
>
>
> The issue lies with the GetOpt::Long configuration. This change fixes
> the problem:
>
>
>
> [newton] ~/mogilefs > svn diff utils/mogadm
>
> Index: utils/mogadm
>
> ===================================================================
>
> --- utils/mogadm (revision 458)
>
> +++ utils/mogadm (working copy)
>
> @@ -135,7 +135,7 @@
>
> "help" => \$opts{help},
>
> "verbose" => \$opts{verbose},
>
> ) or abortWithUsage();
>
> -Getopt::Long::Configure("require_order");
>
> +Getopt::Long::Configure("no_require_order");
>
>
>
> # bail for help
>
> abortWithUsage() if $opts{help};
>
> [newton] ~/mogilefs >
>
>
>
>
>
>
>
>
>
> Thanks,
>
>
>
> Newton
>
>
More information about the mogilefs
mailing list