admin@glassfish.java.net

Re: exit_code: WARNING vs FAILURE

From: Ludovic Champenois <ludovic.champenois_at_oracle.com>
Date: Fri, 05 Nov 2010 14:18:27 -0700

On 11/5/10 1:58 PM, Tom Mueller wrote:
> Please see inline.
>
> On 11/5/2010 3:43 PM, Anissa Lam wrote:
>>
>> I want to discuss the exit_code of ActionReport, WARNING vs FAILURE.
>> Currently, I see that the exit_code is always set to FAILURE,
>> regardless whether the command did what the user tries to do
> It seems that you are making some assumptions about what the user
> really wanted to do.
>>
>> eg. If i want to create an instance, with an existing node
>> "dummyNode", the instance is created, but gives this message,
>> with exit_code "FAILURE"
>>
>> "message":"*Successfully created instance XYZ in the DAS
>> configuration*, but failed to create the instance files on node
>> dummyNode (dummyHost).\n\nThis command requires connecting to host
>> dummyHost using SSH to complete its operation, but it failed to
>> connect:\n\n Command execution failed. There was a problem while
>> connecting to dummyHost:22\n\nPlease verify you have SSH configured
>> correctly on your system with the proper attributes set on node
>> dummyNode. You may use update-node-ssh to modify these attributes.
>> See the DAS log file for more information.\n\nTo complete this
>> operation run the following command locally on host dummyHost from
>> the GlassFish install location
>> \/Users\/anilam\/Awork\/V3\/v3\/dist-gf:\n\n asadmin --host
>> macau2.us.oracle.com --port 4848 create-local-instance --node
>> dummyNode XYZ",
>> "command":"Error",
>> *"exit_code":"FAILURE"*}
> Here is the instance wasn't really created. The DAS configuration was
> updated, but the file system was not created on the node. The command
> is failing because it was unable to do the entire task.
>
>>
>> Or, If I want to create an instance, with a non-existing node, the
>> instance cannot be created, (which is expected), and get the
>> following message, again with an exit_code "FAILURE"
>>
>> "message":"There is no node named NO-SUCH in this domain.",
>> "command":"Error",
>> *"exit_code":"FAILURE"*}
>>
>> The same applies to delete-instance. Even though the instance is
>> deleted, the exit_code will be set to "FAILURE" if there is any
>> issue in the process.
> Here the instance isn't really deleted, because the files are left
> around on the remote node.
>>
>> message=*Successfully removed instance XYZ from the DAS
>> configuration*, but failed to remove the instance files from node
>> dummyNode (dummyHost).\n\nThis command requires connecting to host
>> dummyHost using SSH to complete its operation, but it failed to
>> connect:\n\n Command execution failed. There was a problem while
>> connecting to dummyHost:22\n\nPlease verify you have SSH configured
>> correctly on your system with the proper attributes set on node
>> dummyNode. You may use update-node-ssh to modify these attributes.
>> See the DAS log file for more information.\n\nTo complete this
>> operation run the following command locally on host dummyHost from
>> the GlassFish install location
>> \/Users\/anilam\/Awork\/V3\/v3\/dist-gf:\n\n asadmin
>> delete-local-instance --node dummyNode XYZ",
>> "command":"Error",
>> *"exit_code":"FAILURE"*
>>
>>
>> Admin Console needs to handle things differently whether the actual
>> intended action succeeded or not. We need to direct to different
>> pages depending on the status. Also, once there is failure, we
>> abort any remaining request to finish the task. With the current
>> design, GUI cannot behave correctly.
>> Can we change it, such that WARNING is given instead of FAILURE for
>> situation where the main purpose of the command has succeeded ?
>> Is this a bug or by design ?
> It is by design that a command fails if it is not able to accomplish
> the entire task, including creating or deleting files on the remote host.
>
> What do you think about this?
>
> The ActionReport can have a structure to it, with a main return code,
> and then return code for various subtasks. We could modify select
> commands so that the result of the various subtasks is returns in
> ActionReport sub tasks.
>
> If we were to do this, would you be able to get this detail through REST?
> Specifically which commands would need to be changed?
>
> Tom
>
>>
>> thanks
>> Anissa.
>>


So it seems admin gui is needing a 3rd level between FAILURE and SUCCESS.
This 3rd level would be calculated as:
1/ top command is FAILURE
2/ this command has subactions, and one or more of these subactions has
a SUCCESS value...
We could either do this logic in REST, or in CLI?
Let me know.

Ludo