From 6616664cc3172cc5d847a495042f21cb3fb24007 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 21 May 2007 15:17:22 +0000 Subject: Add argument check (Resolves Ticket #435) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3198 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/sbin') diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index d9d4e9e73..08cc391dd 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -3,7 +3,7 @@ '''Bcfg2 Client''' __revision__ = '$Revision$' -import logging, os, signal, tempfile, time, xmlrpclib +import getopt, logging, os, signal, sys, tempfile, time, xmlrpclib import Bcfg2.Options, Bcfg2.Client.XML, Bcfg2.Client.Frame, Bcfg2.Client.Tools try: @@ -71,7 +71,13 @@ class Client: False, False, False, True), } - self.setup = Bcfg2.Options.OptionParser('bcfg2', optinfo).parse() + optparser = Bcfg2.Options.OptionParser('bcfg2', optinfo) + self.setup = optparser.parse() + if getopt.getopt(sys.argv[1:], + optparser.shortopt, optparser.longopt)[1]: + print "Bcfg2 takes no arguments, only options" + print optparser.helpmsg + raise SystemExit, 1 level = 30 if self.setup['verbose']: level = 20 -- cgit v1.2.3-1-g7c22