[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] This patch adds a checking of wrong parameter into xm dmesg command.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Node ID f3f492ba8e8d630175415ba27df2a48e9e43913d # Parent 55e8f40ef6e4b5131c984c5625bdf30f46268dd3 This patch adds a checking of wrong parameter into xm dmesg command. If wrong parameter is given, xm dmesg command shows the following error messages. Error: No parameter required Usage: xm dmesg [-c|--clear] Read and/or clear Xend's message buffer. -c, --clear Clear dmesg buffer Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx> --- tools/python/xen/xm/main.py | 31 ++++++++++++++----------------- 1 files changed, 14 insertions(+), 17 deletions(-) diff -r 55e8f40ef6e4 -r f3f492ba8e8d tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Wed Nov 01 15:56:22 2006 +0000 +++ b/tools/python/xen/xm/main.py Wed Nov 01 15:56:55 2006 +0000 @@ -1071,26 +1071,23 @@ def xm_dmesg(args): def xm_dmesg(args): arg_check(args, "dmesg", 0, 1) - gopts = Opts(use="""[-c|--clear] - -Read Xen's message buffer (boot output, warning and error messages) or clear -its contents if the [-c|--clear] flag is specified. -""") - - gopts.opt('clear', short='c', - fn=set_true, default=0, - use="Clear the contents of the Xen message buffer.") - # Work around for gopts - myargs = args - myargs.insert(0, 'dmesg') - gopts.parse(myargs) - - if len(myargs) not in (1, 2): - err('Invalid arguments: ' + str(myargs)) + try: + (options, params) = getopt.gnu_getopt(args, 'c', ['clear']) + except getopt.GetoptError, opterr: + err(opterr) + sys.exit(1) + + use_clear = 0 + for (k, v) in options: + if k in ['-c', '--clear']: + use_clear = 1 + + if len(params) : + err("No parameter required") usage('dmesg') sys.exit(1) - if not gopts.vals.clear: + if not use_clear: print server.xend.node.dmesg.info() else: server.xend.node.dmesg.clear() _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |