Bug #71444 mysql fabric exit-code always 0
Submitted: 21 Jan 2014 14:21 Modified: 12 Dec 2014 22:49
Reporter: Jan Kneschke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Fabric Severity:S3 (Non-critical)
Version:1.4.1 OS:Any
Assigned to: CPU Architecture:Any

[21 Jan 2014 14:21] Jan Kneschke
Description:
The exit-code of "mysqlfabric group create ..." is 0 in both the success and the error-case.

In shell-scripting there is no way to catch errors without parsing the content of stdout ... which isn't parsable.

How to repeat:
jan@jan-t420:~/.local/bin$ ./mysqlfabric group create group_id-global; echo $?
Procedure :
{ uuid        = 01cbab7a-8dc8-4585-9629-fd3d15892c4f,
  finished    = True,
  success     = True,
  return      = True,
  activities  =
}
0
jan@jan-t420:~/.local/bin$ ./mysqlfabric group create group_id-global; echo $?
Procedure :
{ uuid        = d7341c6a-c63b-4fef-a728-04ccd7b27896,
  finished    = True,
  success     = False,
  return      = GroupError: Group (group_id-global) already exists.,
  activities  =
}
0

Suggested fix:
Return non-zero exit code in case of error.
[21 Jan 2014 14:54] Alfranio Tavares Correia Junior
Verified as described. Thank you for the bug report!
[5 May 2014 8:23] Mats Kindahl
Posted by developer:
 
For fixing this bug, I think we should follow the traditional conventions:

1         General error
2         Incorrect usage
128+n     Terminated by signal (in particular, 130 == SIGINT, i.e. Ctrl-C)
[12 Dec 2014 22:49] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Fabric 1.6.1 release, and here's the changelog entry:

The exit code of ""mysqlfabric" group create ..." was 0 for both the
success and the error cases. Now, 0 is only returned on success.

Thank you for the bug report.