summaryrefslogtreecommitdiffstats
path: root/ipa-admintools/ipa-addservice
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2008-08-15 18:08:01 +0200
committerMartin Nagy <mnagy@redhat.com>2008-09-11 23:34:01 +0200
commit885103c32127d10250564e25c5895464fb366f9e (patch)
tree5db92cd0d4282b3e1aacbfc04c9d076a0d515bec /ipa-admintools/ipa-addservice
parent57669ba43224eee0d90556aeea03d14873b4bd7f (diff)
downloadfreeipa-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-addservice')
-rw-r--r--ipa-admintools/ipa-addservice19
1 files changed, 7 insertions, 12 deletions
diff --git a/ipa-admintools/ipa-addservice b/ipa-admintools/ipa-addservice
index 29d0bb966..15105bc0f 100644
--- a/ipa-admintools/ipa-addservice
+++ b/ipa-admintools/ipa-addservice
@@ -44,22 +44,19 @@ error was:
""" % sys.exc_value
sys.exit(1)
-def usage():
- print "ipa-addservice [--force] [-v|--verbose] principal"
- sys.exit(1)
-
def parse_options():
- parser = OptionParser()
+ usage = "%prog [options] principal"
+ parser = OptionParser(usage=usage)
parser.add_option("--force", action="store_true", default=False,
help="Force a service principal name")
- 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, "principal")
+ ipa.config.init_config(options)
return options, args
@@ -69,9 +66,7 @@ def main():
options, args = parse_options()
- if len(args) != 2:
- usage()
- princ_name = args[1]
+ princ_name = args[0]
client = ipaclient.IPAClient(verbose=options.verbose)