summaryrefslogtreecommitdiffstats
path: root/ipa-admintools/ipa-deldelegation
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-deldelegation
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-deldelegation')
-rw-r--r--ipa-admintools/ipa-deldelegation26
1 files changed, 10 insertions, 16 deletions
diff --git a/ipa-admintools/ipa-deldelegation b/ipa-admintools/ipa-deldelegation
index 4284af8fa..f11cf4b4e 100644
--- a/ipa-admintools/ipa-deldelegation
+++ b/ipa-admintools/ipa-deldelegation
@@ -7,7 +7,7 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; version 2 only
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
import sys
try:
from optparse import OptionParser
@@ -43,19 +43,16 @@ error was:
aci_fields = ['*', 'aci']
-def usage():
- print "ipa-deldelgation [-v|--verbose] name"
- sys.exit(1)
-
def parse_options():
- parser = OptionParser()
- parser.add_option("--usage", action="store_true",
- help="Program usage")
+ usage = "%prog [-v|--verbose] name"
+ parser = OptionParser(usage=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, "name")
+ ipa.config.init_config(options)
return options, args
@@ -63,9 +60,6 @@ def main():
options, args = parse_options()
- if options.usage or len(args) != 2:
- usage()
-
client = ipaclient.IPAClient(verbose=options.verbose)
aci_entry = client.get_aci_entry(aci_fields)
@@ -80,7 +74,7 @@ def main():
for aci_str in aci_str_list:
try:
aci = ipa.aci.ACI(aci_str)
- if aci.name == args[1]:
+ if aci.name == args[0]:
acistr = aci_str
source_group = aci.source_group
else:
@@ -90,7 +84,7 @@ def main():
pass
if acistr is None:
- print "No delegation '%s' found." % args[1]
+ print "No delegation '%s' found." % args[0]
return 2
old_aci_index = aci_str_list.index(acistr)