diff options
author | rcritten@redhat.com <rcritten@redhat.com> | 2007-09-21 10:24:36 -0400 |
---|---|---|
committer | rcritten@redhat.com <rcritten@redhat.com> | 2007-09-21 10:24:36 -0400 |
commit | 7b969737112c7a26711c3d4a9713ef1ca30f1be8 (patch) | |
tree | 27c9475aaa3951de88eabedfe2e1a125225fe2fe /ipa-admintools/ipa-addgroup | |
parent | 919d037189cd3134d3eb4ba07b5ce131f018936f (diff) | |
download | freeipa.git-7b969737112c7a26711c3d4a9713ef1ca30f1be8.tar.gz freeipa.git-7b969737112c7a26711c3d4a9713ef1ca30f1be8.tar.xz freeipa.git-7b969737112c7a26711c3d4a9713ef1ca30f1be8.zip |
Give ipa-adduser, ipa-addgroup and ipa-usermod an interactive mode
Add ipa-passwd tool
Add simple field validation package
This patch adds a package requirement, python-krbV. This is needed to
determine the current user based on their kerberos ticket.
Diffstat (limited to 'ipa-admintools/ipa-addgroup')
-rw-r--r-- | ipa-admintools/ipa-addgroup | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/ipa-admintools/ipa-addgroup b/ipa-admintools/ipa-addgroup index f590f579..ba1a0999 100644 --- a/ipa-admintools/ipa-addgroup +++ b/ipa-admintools/ipa-addgroup @@ -23,6 +23,7 @@ from optparse import OptionParser import ipa import ipa.group import ipa.ipaclient as ipaclient +import ipa.ipavalidate as ipavalidate import ipa.config import ipa.ipaerror @@ -49,22 +50,51 @@ def parse_options(): return options, args def main(): + cn = "" + desc = "" + group=ipa.group.Group() options, args = parse_options() - if len(args) != 2: - usage() + cont = False + + if (len(args) != 2): + while (cont != True): + cn = raw_input("Group name: ") + if (ipavalidate.plain(cn, notEmpty=True)): + print "Field is required and must be letters or '." + else: + cont = True + else: + cn = args[1] + if (ipavalidate.plain(cn, notEmpty=True)): + print "Group name is required and must be letters or '." + return 1 + + cont = False + if not options.desc: + while (cont != True): + desc = raw_input("Description: ") + if (ipavalidate.plain(desc, notEmpty=True)): + print "Field is required and must be letters or '." + else: + cont = True + else: + desc = options.desc + if (ipavalidate.plain(desc, notEmpty=True)): + print "First name is required and must be letters or '." + return 1 - group.setValue('cn', args[1]) - if options.desc: - group.setValue('description', options.desc) if options.gid: group.setValue('gidnumber', options.gid) + group.setValue('cn', cn) + group.setValue('description', desc) + try: client = ipaclient.IPAClient() client.add_group(group) - print args[1] + " successfully added" + print cn + " successfully added" except xmlrpclib.Fault, f: print f.faultString return 1 |