Handle the --usage option by actually displaying the usage

Fix some missing options in --usage
Remove a few debugging statements
Resolves 430704
This commit is contained in:
Rob Crittenden
2008-01-31 10:52:05 -05:00
parent ae5cb78ab8
commit 64cce8f82e
15 changed files with 34 additions and 18 deletions
+4 -1
View File
@@ -34,7 +34,7 @@ import ldap
import errno
def usage():
print "ipa-adddelgation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
print "ipa-adddelgation [-a|--attributes attr1,attr2,..,attrn] [-l|--list] [-s|--source STRING] [-t|--target STRING] name"
sys.exit(1)
def parse_options():
@@ -59,6 +59,9 @@ def main():
options, args = parse_options()
if options.usage:
usage()
if options.list:
client = ipaclient.IPAClient()
list = client.get_all_attrs()
+4 -1
View File
@@ -33,7 +33,7 @@ import ldap
import errno
def usage():
print "ipa-addgroup [-d|--description STRING] group"
print "ipa-addgroup [-d|--description STRING] [-g|--gid GID] group"
sys.exit(1)
def parse_options():
@@ -57,6 +57,9 @@ def main():
group=ipa.group.Group()
options, args = parse_options()
if options.usage:
usage()
cont = False
if (len(args) != 2):
+4 -1
View File
@@ -34,7 +34,7 @@ import getpass
import errno
def usage():
print "ipa-adduser [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] user"
print "ipa-adduser [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell] [-g|--groups] [-k|krb-principal [-M|mailAddress] user"
sys.exit(1)
def parse_options():
@@ -86,6 +86,9 @@ def main():
user=ipa.user.User()
options, args = parse_options()
if options.usage:
usage()
if len(args) != 2:
all_interactive = True
+1 -2
View File
@@ -51,8 +51,7 @@ def main():
options, args = parse_options()
if len(args) != 2:
print "args is %s" % len(args)
if options.usage or len(args) != 2:
usage()
client = ipaclient.IPAClient()
+1 -1
View File
@@ -45,7 +45,7 @@ def parse_options():
def main():
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
try:
+1 -1
View File
@@ -45,7 +45,7 @@ def parse_options():
def main():
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
try:
+2 -2
View File
@@ -30,7 +30,7 @@ import xmlrpclib
import kerberos
def usage():
print "ipa-findgroup <group_name>"
print "ipa-findgroup [-a|--all] [-n|--notranslate] group"
sys.exit()
def parse_options():
@@ -51,7 +51,7 @@ def main():
group={}
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
try:
+1 -1
View File
@@ -50,7 +50,7 @@ def main():
user={}
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
try:
+2 -2
View File
@@ -32,7 +32,7 @@ import xmlrpclib
import kerberos
def usage():
print "ipa-finduser user"
print "ipa-finduser [-a|--all] [-n|--notranslate] user"
sys.exit()
def parse_options():
@@ -76,7 +76,7 @@ def main():
user={}
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
try:
+3
View File
@@ -50,6 +50,9 @@ def main():
options, args = parse_options()
if options.usage:
usage()
client = ipaclient.IPAClient()
try:
aci_entry = client.get_aci_entry(aci_fields)
+2 -2
View File
@@ -29,7 +29,7 @@ import xmlrpclib
import kerberos
def usage():
print "ipa-lockuser user"
print "ipa-lockuser [-u|--unlock] user"
sys.exit(1)
def parse_options():
@@ -47,7 +47,7 @@ def parse_options():
def main():
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
msg = "inactivated"
+1 -2
View File
@@ -60,8 +60,7 @@ def main():
options, args = parse_options()
if len(args) != 2:
print "args is %s" % len(args)
if options.usage or len(args) != 2:
usage()
if not options.attributes and not options.source and not options.target:
+2
View File
@@ -89,6 +89,8 @@ def main():
group=ipa.group.Group()
options, args = parse_options()
if options.usage:
usage()
if (options.add or options.remove) and (len(args) != 3):
usage()
elif ((options.desc or options.addattr or options.delattr or options.setattr) and (len(args) != 2)):
+1 -1
View File
@@ -86,7 +86,7 @@ def main():
options, args = parse_options()
if len(args) != 2:
if options.usage or len(args) != 2:
usage()
username = args[1]
+5 -1
View File
@@ -61,9 +61,13 @@ def main():
username = None
principal = None
krbctx = krbV.default_context()
options, args = parse_options()
if options.usage:
usage()
krbctx = krbV.default_context()
if len(args) == 2:
username = args[1]
else: