diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-01-31 10:52:05 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-01-31 10:52:05 -0500 |
commit | 64cce8f82e08f0716eec3fd4c1f3c0fccf309fba (patch) | |
tree | eea4477c5de7caf07809b5f893f0d8972f1bccc2 | |
parent | ae5cb78ab804f289b1b0c05cc0cf219585c990ac (diff) | |
download | freeipa-64cce8f82e08f0716eec3fd4c1f3c0fccf309fba.tar.gz freeipa-64cce8f82e08f0716eec3fd4c1f3c0fccf309fba.tar.xz freeipa-64cce8f82e08f0716eec3fd4c1f3c0fccf309fba.zip |
Handle the --usage option by actually displaying the usage
Fix some missing options in --usage
Remove a few debugging statements
Resolves 430704
-rw-r--r-- | ipa-admintools/ipa-adddelegation | 5 | ||||
-rw-r--r-- | ipa-admintools/ipa-addgroup | 5 | ||||
-rw-r--r-- | ipa-admintools/ipa-adduser | 5 | ||||
-rw-r--r-- | ipa-admintools/ipa-deldelegation | 3 | ||||
-rw-r--r-- | ipa-admintools/ipa-delgroup | 2 | ||||
-rw-r--r-- | ipa-admintools/ipa-deluser | 2 | ||||
-rw-r--r-- | ipa-admintools/ipa-findgroup | 4 | ||||
-rw-r--r-- | ipa-admintools/ipa-findservice | 2 | ||||
-rw-r--r-- | ipa-admintools/ipa-finduser | 4 | ||||
-rw-r--r-- | ipa-admintools/ipa-listdelegation | 3 | ||||
-rw-r--r-- | ipa-admintools/ipa-lockuser | 4 | ||||
-rw-r--r-- | ipa-admintools/ipa-moddelegation | 3 | ||||
-rw-r--r-- | ipa-admintools/ipa-modgroup | 2 | ||||
-rw-r--r-- | ipa-admintools/ipa-moduser | 2 | ||||
-rw-r--r-- | ipa-admintools/ipa-passwd | 6 |
15 files changed, 34 insertions, 18 deletions
diff --git a/ipa-admintools/ipa-adddelegation b/ipa-admintools/ipa-adddelegation index 5b5a34de1..5ecd70ada 100644 --- a/ipa-admintools/ipa-adddelegation +++ b/ipa-admintools/ipa-adddelegation @@ -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() diff --git a/ipa-admintools/ipa-addgroup b/ipa-admintools/ipa-addgroup index e8c89ed58..c8a764f10 100644 --- a/ipa-admintools/ipa-addgroup +++ b/ipa-admintools/ipa-addgroup @@ -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): diff --git a/ipa-admintools/ipa-adduser b/ipa-admintools/ipa-adduser index 298834258..3f4c98eb1 100644 --- a/ipa-admintools/ipa-adduser +++ b/ipa-admintools/ipa-adduser @@ -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 diff --git a/ipa-admintools/ipa-deldelegation b/ipa-admintools/ipa-deldelegation index 030d462ff..07613d564 100644 --- a/ipa-admintools/ipa-deldelegation +++ b/ipa-admintools/ipa-deldelegation @@ -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() diff --git a/ipa-admintools/ipa-delgroup b/ipa-admintools/ipa-delgroup index ec911085d..228ce1d1f 100644 --- a/ipa-admintools/ipa-delgroup +++ b/ipa-admintools/ipa-delgroup @@ -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: diff --git a/ipa-admintools/ipa-deluser b/ipa-admintools/ipa-deluser index 79a521560..596a124c5 100644 --- a/ipa-admintools/ipa-deluser +++ b/ipa-admintools/ipa-deluser @@ -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: diff --git a/ipa-admintools/ipa-findgroup b/ipa-admintools/ipa-findgroup index b5a5f0766..e10228679 100644 --- a/ipa-admintools/ipa-findgroup +++ b/ipa-admintools/ipa-findgroup @@ -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: diff --git a/ipa-admintools/ipa-findservice b/ipa-admintools/ipa-findservice index f9b64d3bf..41688e799 100644 --- a/ipa-admintools/ipa-findservice +++ b/ipa-admintools/ipa-findservice @@ -50,7 +50,7 @@ def main(): user={} options, args = parse_options() - if len(args) != 2: + if options.usage or len(args) != 2: usage() try: diff --git a/ipa-admintools/ipa-finduser b/ipa-admintools/ipa-finduser index 27c4746e6..81da24efd 100644 --- a/ipa-admintools/ipa-finduser +++ b/ipa-admintools/ipa-finduser @@ -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: diff --git a/ipa-admintools/ipa-listdelegation b/ipa-admintools/ipa-listdelegation index 6999e5f83..6a718dec3 100644 --- a/ipa-admintools/ipa-listdelegation +++ b/ipa-admintools/ipa-listdelegation @@ -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) diff --git a/ipa-admintools/ipa-lockuser b/ipa-admintools/ipa-lockuser index f5aaa37c1..d4a2959d5 100644 --- a/ipa-admintools/ipa-lockuser +++ b/ipa-admintools/ipa-lockuser @@ -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" diff --git a/ipa-admintools/ipa-moddelegation b/ipa-admintools/ipa-moddelegation index 2be10b9f6..24bd640b6 100644 --- a/ipa-admintools/ipa-moddelegation +++ b/ipa-admintools/ipa-moddelegation @@ -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: diff --git a/ipa-admintools/ipa-modgroup b/ipa-admintools/ipa-modgroup index f3f603282..4e17db59c 100644 --- a/ipa-admintools/ipa-modgroup +++ b/ipa-admintools/ipa-modgroup @@ -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)): diff --git a/ipa-admintools/ipa-moduser b/ipa-admintools/ipa-moduser index babdea6c4..6b19ff50f 100644 --- a/ipa-admintools/ipa-moduser +++ b/ipa-admintools/ipa-moduser @@ -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] diff --git a/ipa-admintools/ipa-passwd b/ipa-admintools/ipa-passwd index ec656fdb8..1e658a85b 100644 --- a/ipa-admintools/ipa-passwd +++ b/ipa-admintools/ipa-passwd @@ -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: |