admin@glassfish.java.net

Re: --echo

From: kedar <Kedar.Mhaswade_at_Sun.COM>
Date: Mon, 10 Aug 2009 15:53:54 -0700

Bill Shannon wrote:
> Can someone help me understand the background and use of the --echo
> option to asadmin?
>
> At a very simple level this seemed to me to be like "sh -x", simply
> echoing each command as its executed. This would be useful "asadmin
> scripts" run in multimode, for instance.
>
> In v2, the --echo option would echo more than just the original command.
> It would also echo most (all?) of the settings of the other asadmin
> options, such as --interactive, --secure, --terse, etc. I've copied
> that behavior in v3.
>
> However, this produces echo output that uses the old deprecated command
> syntax, for example:
>
> $ asadmin --echo --terse version
> version --host localhost --port 4848 --interactive=true --echo=true --terse=true
> ...
>
> changing that output to put the asadmin options first would be weird
> unless it also included the word "asadmin", e.g.
>
> asadmin --host localhost --port 4848 --interactive=true --echo=true --terse=true
> version
>
> That would be fine except when the commands are being executed in a
> multimode script (which seems to me like the primary use case).
>
> So, my question is, how important is it that --echo include values for
> asadmin options that have not been specified? Would it be sufficient
> if asadmin simply echoed the commands *as entered*?

I don't know the history too well, but ...
I have routinely used the --echo flag to see the default values of certain
options. So, from that angle, it's useful that it echoes not only those options
that users specified on the command line. This was compounded by the fact that
some options may come from the environment variables. echo used to treat them
all and produce an output that used to tell the user what the final command line
looks like, which is sometimes useful.

With echo now being an asadmin program option, I see that the situation gets
trickier and we can make a case that we change the behavior of echo slightly, to
echo only the given (and maybe default) "command options" along with
program options. How about for example,

$ asadmin --echo version
asadmin program options: --host localhost --port 4848 --terse false
--interactive true --secure false --echo false
command: version --verbose false

...

Also, note that we should be consistent in the display. For example, in your
example, not all options and their values are separated by an '=' or ' '. We
need to pick one.

If this makes it complex, maybe we should add a command named "defaults" that
shows the default values of asadmin program options and then we have to do
none of this and just echo the given command line verbatim?

If you are worried about multimode, I think Byron has added a capability where
asadmin logs all the commands in an asadmin "session" to a file for subsequent
analysis of an asadmin run. Maybe we should document it more clearly?


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>