summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-05-21 15:17:22 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-05-21 15:17:22 +0000
commit6616664cc3172cc5d847a495042f21cb3fb24007 (patch)
treec3aa048d2933d3a62d6d0ee5409998632a25e613
parent0b97ec7dc01bb3c7c0a5c942395c1517544044c9 (diff)
downloadbcfg2-6616664cc3172cc5d847a495042f21cb3fb24007.tar.gz
bcfg2-6616664cc3172cc5d847a495042f21cb3fb24007.tar.bz2
bcfg2-6616664cc3172cc5d847a495042f21cb3fb24007.zip
Add argument check (Resolves Ticket #435)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3198 ce84e21b-d406-0410-9b95-82705330c041
-rwxr-xr-xsrc/sbin/bcfg210
1 files changed, 8 insertions, 2 deletions
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