diff options
author | Martin Nagy <mnagy@redhat.com> | 2008-08-15 18:08:01 +0200 |
---|---|---|
committer | Martin Nagy <mnagy@redhat.com> | 2008-09-11 23:34:01 +0200 |
commit | 885103c32127d10250564e25c5895464fb366f9e (patch) | |
tree | 5db92cd0d4282b3e1aacbfc04c9d076a0d515bec /ipa-admintools/ipa-findgroup | |
parent | 57669ba43224eee0d90556aeea03d14873b4bd7f (diff) | |
download | freeipa-885103c32127d10250564e25c5895464fb366f9e.tar.gz freeipa-885103c32127d10250564e25c5895464fb366f9e.tar.xz freeipa-885103c32127d10250564e25c5895464fb366f9e.zip |
Rework config.py and change cli tools. Maintain order of IPA servers from command line, config and DNS. Parse options before detecting IPA configuration. Don't ignore rest of the options if one is missing in ipa.conf. Drop the --usage options, we will rely on --help. Fixes: 458869, 459070, 458980, 459234
Diffstat (limited to 'ipa-admintools/ipa-findgroup')
-rw-r--r-- | ipa-admintools/ipa-findgroup | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/ipa-admintools/ipa-findgroup b/ipa-admintools/ipa-findgroup index 9e514eee..d9a9acc3 100644 --- a/ipa-admintools/ipa-findgroup +++ b/ipa-admintools/ipa-findgroup @@ -39,25 +39,22 @@ error was: """ % sys.exc_value sys.exit(1) -def usage(): - print "ipa-findgroup [-a|--all] [-n|--notranslate] [-v|--verbose] group" - sys.exit() - def parse_options(): - parser = OptionParser() + usage = "%prog [options] group" + parser = OptionParser(usage=usage) parser.add_option("-a", "--all", action="store_true", dest="all", help="Show all group attributes") parser.add_option("-n", "--notranslate", action="store_true", dest="notranslate", help="Don't translate LDAP attributes into readable labels") - parser.add_option("--usage", action="store_true", - help="Program usage") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Verbose output of the XML-RPC connection") - args = ipa.config.init_config(sys.argv) - options, args = parser.parse_args(args) + ipa.config.add_standard_options(parser) + options, args = parser.parse_args() + ipa.config.verify_args(parser, args, "group") + ipa.config.init_config(options) return options, args @@ -65,20 +62,17 @@ def main(): group={} options, args = parse_options() - if options.usage or len(args) != 2: - usage() - client = ipaclient.IPAClient(verbose=options.verbose) if options.all is None: - groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock']) + groups = client.find_groups(args[0], ['cn','description','gidnumber','nsAccountLock']) else: - groups = client.find_groups(args[1], sattrs=['*','nsAccountLock']) + groups = client.find_groups(args[0], sattrs=['*','nsAccountLock']) counter = groups[0] groups = groups[1:] groupindex = -1 if counter == 0: - print "No entries found for", args[1] + print "No entries found for", args[0] return 2 elif counter == -1: print "These results are truncated." @@ -129,7 +123,7 @@ def main(): for m in members: print " " + m.getValue('cn') + ": " + m.dn # blank line between results - print + print return 0 |