]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: do not throw on unknown errno 5368/head
authorKefu Chai <kchai@redhat.com>
Thu, 16 Apr 2015 10:29:00 +0000 (18:29 +0800)
committerLoic Dachary <ldachary@redhat.com>
Tue, 28 Jul 2015 12:49:03 +0000 (14:49 +0200)
some of the errnos are not listed in errno.errorcode. if we happen
to run into them, print 'Unknown' instead.

Fixes: #11354
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 53514ad97f6f75746613f09d464f69a7c31bed55)

src/ceph.in

index 2b6adf4dc579a43bed4ae60bccc832f579e49e06..51b2a39877d2cc00478b06361f0fbf8946bb942d 100755 (executable)
@@ -459,7 +459,7 @@ def new_style_command(parsed_args, cmdargs, target, sigdict, inbuf, verbose):
                     if ret:
                         ret = abs(ret)
                         print >> sys.stderr, \
-                            'Error: {0} {1}'.format(ret, errno.errorcode[ret])
+                            'Error: {0} {1}'.format(ret, errno.errorcode.get(ret, 'Unknown'))
                     if outbuf:
                         print outbuf
                     if outs:
@@ -858,11 +858,11 @@ def main():
                                                           sigdict, inbuf, verbose)
                     if ret < 0:
                         ret = -ret
-                        print >> sys.stderr, prefix + 'Second attempt of previously successful command failed with {0}: {1}'.format(errno.errorcode[ret], outs)
+                        print >> sys.stderr, prefix + 'Second attempt of previously successful command failed with {0}: {1}'.format(errno.errorcode.get(ret, 'Unknown'), outs)
 
         if ret < 0:
             ret = -ret
-            print >> sys.stderr, prefix + 'Error {0}: {1}'.format(errno.errorcode[ret], outs)
+            print >> sys.stderr, prefix + 'Error {0}: {1}'.format(errno.errorcode.get(ret, 'Unknown'), outs)
             if len(targets) > 1:
                 final_ret = ret
             else: