Hi all,
Is targetcli-fb still the only user of configshell-fb? Other users would hopefully be on this list, right? Well, I sure hope so...
One long-standing issue with targetcli is that when giving it single commands from the command line, it doesn't return a nonzero error code if there's an error of certain types -- it prints a message, but a success error code. This makes it hard for targetcli to be scripted. Not that I think scripting targetcli is a great way to do things, but people seem to be doing it a lot.
The fix for this is to change the way configshell's command loop works, so that critical ExecutionError exceptions aren't swallowed by configshell, but propagate to the caller (in targetcli's case, "scripts/targetcli"). The caller then has the option to print the error and continue (likely what you want to do if in interactive mode) or exit with an error (what we want to do for cmdline mode).
So, before I go ahead, any objections, or discussion? Speak up, or I'm going ahead early next week :)
Regards -- Andy
Hi Andy,
On Thu, 27 Feb 2014 11:30:35 -0800, Andy Grover wrote :
One long-standing issue with targetcli is that when giving it single commands from the command line, it doesn't return a nonzero error code if there's an error of certain types -- it prints a message, but a success error code. This makes it hard for targetcli to be scripted. [snip] So, before I go ahead, any objections, or discussion? Speak up, or I'm going ahead early next week :)
+1. Targetcli should return a status code, otherwise it cannot be used safely in scripts. What error codes are you going to define?
0: OK 1: Failure
Or
0: OK 1: Minor error 2: Serious error
Or
0: OK 1: Error of some kind 2: Error of another kind 3: Yet another kind of error
Best regards,
On 02/27/2014 12:55 PM, Christophe Vu-Brugier wrote:
Hi Andy,
On Thu, 27 Feb 2014 11:30:35 -0800, Andy Grover wrote :
One long-standing issue with targetcli is that when giving it single commands from the command line, it doesn't return a nonzero error code if there's an error of certain types -- it prints a message, but a success error code. This makes it hard for targetcli to be scripted. [snip] So, before I go ahead, any objections, or discussion? Speak up, or I'm going ahead early next week :)
+1. Targetcli should return a status code, otherwise it cannot be used safely in scripts. What error codes are you going to define?
0: OK 1: Failure
after a little Googling and finding:
http://tldp.org/LDP/abs/html/exitcodes.html
very likely just this one, was the current plan.
-- Andy
targetcli-fb-devel@lists.fedorahosted.org