Skip to content

Commit 63a01f3

Browse files
committed
Handle xmlrpclib.Fault cleanly, and document the exit codes in the man page
1 parent 62cbb8c commit 63a01f3

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

bin/bugzilla

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import bugzilla.util
1818
import locale
1919
import pprint
2020
import socket
21+
import xmlrpclib
2122

2223
version = '0.6.0'
2324
default_bz = 'https://bugzilla.redhat.com/xmlrpc.cgi'
@@ -263,7 +264,12 @@ by Bugzilla.
263264
bugzilla query --bug_id 62037
264265
.SH EXIT STATUS
265266
.BR bugzilla
266-
returns 1 if login fails or it is interrupted, and 0 otherwise.
267+
normally returns 0 if the requested command was successful. Otherwise, exit
268+
status is 1 if
269+
.BR bugzilla
270+
is interrupted by the user (or a login attempt fails), 2 if a
271+
socket error occurs (e.g. TCP connection timeout), and 3 if the server returns
272+
an XML-RPC fault.
267273
.SH NOTES
268274
Not everything that's exposed in the Web UI is exposed by XML-RPC, and not
269275
everything that's exposed by XML-RPC is used by
@@ -659,3 +665,6 @@ if __name__ == '__main__':
659665
except socket.error, e:
660666
print "\nConnection lost/failed: %s" % str(e)
661667
sys.exit(2)
668+
except xmlrpclib.Fault, e:
669+
print "\nServer error: %s" % str(e)
670+
sys.exit(3)

bugzilla.1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH bugzilla 1 "February 25, 2010" "version 0.6.0" "User Commands"
1+
.TH bugzilla 1 "April 02, 2010" "version 0.6.0" "User Commands"
22
.SH NAME
33
bugzilla \- command-line interface to Bugzilla over XML-RPC
44
.SH SYNOPSIS
@@ -192,7 +192,12 @@ show this help message and exit
192192
bugzilla query --bug_id 62037
193193
.SH EXIT STATUS
194194
.BR bugzilla
195-
returns 1 if login fails or it is interrupted, and 0 otherwise.
195+
normally returns 0 if the requested command was successful. Otherwise, exit
196+
status is 1 if
197+
.BR bugzilla
198+
is interrupted by the user (or a login attempt fails), 2 if a
199+
socket error occurs (e.g. TCP connection timeout), and 3 if the server returns
200+
an XML-RPC fault.
196201
.SH NOTES
197202
Not everything that's exposed in the Web UI is exposed by XML-RPC, and not
198203
everything that's exposed by XML-RPC is used by

0 commit comments

Comments
 (0)