mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
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:
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -50,7 +50,7 @@ def main():
|
||||
user={}
|
||||
options, args = parse_options()
|
||||
|
||||
if len(args) != 2:
|
||||
if options.usage or len(args) != 2:
|
||||
usage()
|
||||
|
||||
try:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)):
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user