[sysadmin-bin] ftpadmin: nicer error handling and make show-info work again
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] ftpadmin: nicer error handling and make show-info work again
- Date: Thu, 10 Mar 2011 12:33:36 +0000 (UTC)
commit ec8a6ce5d1bcb12f1595178cc53965781473ba41
Author: Olav Vitters <olav vitters nl>
Date: Thu Mar 10 13:33:30 2011 +0100
ftpadmin: nicer error handling and make show-info work again
ftpadmin | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index eca1bfd..d35e446 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -18,6 +18,7 @@ import bz2
import lzma # pyliblzma
import subprocess
import argparse
+import errno
from email.mime.text import MIMEText
import json
try:
@@ -939,7 +940,9 @@ def main():
)
# show-info
parser_show_info = subparsers.add_parser('show-info', help='show module information')
- parser_show_info.set_defaults(func=cmd_show_info)
+ parser_show_info.add_argument("-s", "--section", choices=SECTIONS,
+ help="Section to install the file to")
+ parser_show_info.set_defaults(func=cmd_show_info, section=DEFAULT_SECTION)
# sudo
parser_sudo = subparsers.add_parser('sudo', help='install tarballs uploaded using rsync')
parser_sudo.set_defaults(func=cmd_sudo)
@@ -967,7 +970,19 @@ def main():
if DEBUG:
print "WARNING: Running in DEBUG MODE!"
- options.func(options, parser)
+ try:
+ options.func(options, parser)
+ except KeyboardInterrupt:
+ print('Interrupted')
+ sys.exit(1)
+ except EOFError:
+ print('EOF')
+ sys.exit(1)
+ except IOError, e:
+ if e.errno != errno.EPIPE:
+ raise
+ sys.exit(0)
+
if __name__ == "__main__":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]