summaryrefslogtreecommitdiffstats
path: root/ipa-admintools
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-04-24 10:25:30 -0400
committerRob Crittenden <rcritten@redhat.com>2008-04-25 10:35:22 -0400
commit12ea8efc0b05f361a5871451cb095753c8c6cc16 (patch)
tree29756a022f9ee691250cc71e2a06165b8938ab8b /ipa-admintools
parent47e6a75cffeeec9e4d0bb9bb73931dd5cdab1a9f (diff)
downloadfreeipa-12ea8efc0b05f361a5871451cb095753c8c6cc16.tar.gz
freeipa-12ea8efc0b05f361a5871451cb095753c8c6cc16.tar.xz
freeipa-12ea8efc0b05f361a5871451cb095753c8c6cc16.zip
Add --verbose option so the HTTP headers and XML request/response can be seen.
Also re-do the way modules are imported. I was attemping to have ^C handled gracefully but the way I did it could mask other problems. 443987
Diffstat (limited to 'ipa-admintools')
-rw-r--r--ipa-admintools/ipa-adddelegation44
-rw-r--r--ipa-admintools/ipa-addgroup42
-rw-r--r--ipa-admintools/ipa-addservice48
-rw-r--r--ipa-admintools/ipa-adduser44
-rw-r--r--ipa-admintools/ipa-deldelegation40
-rw-r--r--ipa-admintools/ipa-delgroup34
-rw-r--r--ipa-admintools/ipa-delservice40
-rw-r--r--ipa-admintools/ipa-deluser34
-rw-r--r--ipa-admintools/ipa-findgroup36
-rw-r--r--ipa-admintools/ipa-findservice36
-rw-r--r--ipa-admintools/ipa-finduser41
-rw-r--r--ipa-admintools/ipa-listdelegation40
-rw-r--r--ipa-admintools/ipa-lockuser34
-rw-r--r--ipa-admintools/ipa-moddelegation44
-rw-r--r--ipa-admintools/ipa-modgroup42
-rw-r--r--ipa-admintools/ipa-moduser40
-rw-r--r--ipa-admintools/ipa-passwd38
-rw-r--r--ipa-admintools/ipa-pwpolicy36
18 files changed, 448 insertions, 265 deletions
diff --git a/ipa-admintools/ipa-adddelegation b/ipa-admintools/ipa-adddelegation
index bd55d053..a7748cc9 100644
--- a/ipa-admintools/ipa-adddelegation
+++ b/ipa-admintools/ipa-adddelegation
@@ -17,10 +17,34 @@
# 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
+ import ipa
+ import ipa.user
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.aci
+ import ipa.ipaadminutil as ipaadminutil
+ import ipa.ipautil as ipautil
+
+ import xmlrpclib
+ import kerberos
+ import krbV
+ import ldap
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
print "ipa-adddelegation [-l|--list]"
- print "ipa-adddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
+ print "ipa-adddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] [-v|--verbose] name"
sys.exit(1)
def parse_options():
@@ -33,6 +57,8 @@ def parse_options():
help="The target group name")
parser.add_option("-l", "--list", dest="list", action="store_true",
help="List common attributes (this is not an exhaustive list)")
+ parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
+ help="Verbose output of the XML-RPC connection")
parser.add_option("--usage", action="store_true",
help="Program usage")
@@ -151,22 +177,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.user
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.aci
- import ipa.ipaadminutil as ipaadminutil
- import ipa.ipautil as ipautil
-
- import xmlrpclib
- import kerberos
- import krbV
- import ldap
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-addgroup b/ipa-admintools/ipa-addgroup
index 58190c02..6bf35f6f 100644
--- a/ipa-admintools/ipa-addgroup
+++ b/ipa-admintools/ipa-addgroup
@@ -17,9 +17,32 @@
# 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
+ import ipa
+ import ipa.group
+ import ipa.ipaclient as ipaclient
+ import ipa.ipavalidate as ipavalidate
+ import ipa.ipautil as ipautil
+ import ipa.config
+ import ipa.ipaerror
+
+ import xmlrpclib
+ import kerberos
+ import ldap
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-addgroup [-d|--description STRING] [-g|--gid GID] group"
+ print "ipa-addgroup [-d|--description STRING] [-g|--gid GID] [-v|--verbose] group"
sys.exit(1)
def parse_options():
@@ -28,6 +51,8 @@ def parse_options():
help="A description of this group")
parser.add_option("-g", "--gid", dest="gid",
help="The gid to use for this group. If not included one is automatically set.")
+ parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
+ help="Verbose output of the XML-RPC connection")
parser.add_option("--usage", action="store_true",
help="Program usage")
@@ -88,21 +113,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.group
- import ipa.ipaclient as ipaclient
- import ipa.ipavalidate as ipavalidate
- import ipa.ipautil as ipautil
- import ipa.config
- import ipa.ipaerror
-
- import xmlrpclib
- import kerberos
- import ldap
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-addservice b/ipa-admintools/ipa-addservice
index 1702069d..67ec8343 100644
--- a/ipa-admintools/ipa-addservice
+++ b/ipa-admintools/ipa-addservice
@@ -17,9 +17,35 @@
# 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
+ import ipa
+ import ipa.user
+ import ipa.ipaclient as ipaclient
+ import ipa.ipavalidate as ipavalidate
+ import ipa.ipautil as ipautil
+ import ipa.config
+
+ import base64
+
+ import xmlrpclib
+ import kerberos
+ import krbV
+ import ldap
+ import getpass
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-addservice [--force] principal"
+ print "ipa-addservice [--force] [-v|--verbose] principal"
sys.exit(1)
def parse_options():
@@ -29,6 +55,8 @@ def parse_options():
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)
@@ -52,24 +80,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.user
- import ipa.ipaclient as ipaclient
- import ipa.ipavalidate as ipavalidate
- import ipa.ipautil as ipautil
- import ipa.config
-
- import base64
-
- import xmlrpclib
- import kerberos
- import krbV
- import ldap
- import getpass
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-adduser b/ipa-admintools/ipa-adduser
index e6ce0e5e..be0912e9 100644
--- a/ipa-admintools/ipa-adduser
+++ b/ipa-admintools/ipa-adduser
@@ -17,9 +17,33 @@
# 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
+ import ipa
+ import ipa.user
+ import ipa.ipaclient as ipaclient
+ import ipa.ipavalidate as ipavalidate
+ import ipa.ipautil as ipautil
+ import ipa.config
+
+ import xmlrpclib
+ import kerberos
+ import krbV
+ import ldap
+ import getpass
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- 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"
+ print "ipa-adduser [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell] [-g|--groups] [-k|krb-principal [-M|mailAddress] [-v|--verbose] user"
sys.exit(1)
def parse_options():
@@ -44,6 +68,8 @@ def parse_options():
help="Set user's e-mail address")
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)
@@ -221,22 +247,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.user
- import ipa.ipaclient as ipaclient
- import ipa.ipavalidate as ipavalidate
- import ipa.ipautil as ipautil
- import ipa.config
-
- import xmlrpclib
- import kerberos
- import krbV
- import ldap
- import getpass
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-deldelegation b/ipa-admintools/ipa-deldelegation
index fc33a9ba..1eeb5172 100644
--- a/ipa-admintools/ipa-deldelegation
+++ b/ipa-admintools/ipa-deldelegation
@@ -17,17 +17,41 @@
# 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
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+
+ import xmlrpclib
+ import kerberos
+ import copy
+ import errno
+
+ import ipa.aci
+ from ipa import ipaerror
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
aci_fields = ['*', 'aci']
def usage():
- print "ipa-deldelgation name"
+ print "ipa-deldelgation [-v|--verbose] name"
sys.exit(1)
def parse_options():
parser = OptionParser()
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)
@@ -92,20 +116,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
-
- import xmlrpclib
- import kerberos
- import copy
- import errno
-
- import ipa.aci
- from ipa import ipaerror
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-delgroup b/ipa-admintools/ipa-delgroup
index 34f5f271..cf66ac1a 100644
--- a/ipa-admintools/ipa-delgroup
+++ b/ipa-admintools/ipa-delgroup
@@ -17,15 +17,36 @@
# 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
+ import ipa
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+ import errno
+
+ import xmlrpclib
+ import kerberos
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-delgroup group"
+ print "ipa-delgroup [-v|--verbose] group"
sys.exit(1)
def parse_options():
parser = OptionParser()
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)
@@ -60,17 +81,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
- import errno
-
- import xmlrpclib
- import kerberos
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-delservice b/ipa-admintools/ipa-delservice
index 610d79b6..d9807629 100644
--- a/ipa-admintools/ipa-delservice
+++ b/ipa-admintools/ipa-delservice
@@ -17,13 +17,38 @@
# 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
+ import ipa
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+
+ import xmlrpclib
+ import kerberos
+ import krbV
+ import ldap
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-delservice principal"
+ print "ipa-delservice [-v|--verbose] principal"
sys.exit(1)
def parse_options():
parser = OptionParser()
+ 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)
@@ -60,19 +85,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
-
- import xmlrpclib
- import kerberos
- import krbV
- import ldap
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-deluser b/ipa-admintools/ipa-deluser
index 36f113db..39bdff91 100644
--- a/ipa-admintools/ipa-deluser
+++ b/ipa-admintools/ipa-deluser
@@ -17,15 +17,36 @@
# 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
+ import ipa
+ import ipa.ipaclient as ipaclient
+ import ipa.ipautil as ipautil
+ import ipa.config
+ import errno
+
+ import xmlrpclib
+ import kerberos
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-deluser user"
+ print "ipa-deluser [-v|--verbose] user"
sys.exit(1)
def parse_options():
parser = OptionParser()
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)
@@ -45,17 +66,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.ipaclient as ipaclient
- import ipa.ipautil as ipautil
- import ipa.config
- import errno
-
- import xmlrpclib
- import kerberos
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-findgroup b/ipa-admintools/ipa-findgroup
index 706e77ae..0c0cf8ef 100644
--- a/ipa-admintools/ipa-findgroup
+++ b/ipa-admintools/ipa-findgroup
@@ -17,9 +17,29 @@
# 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
+ import ipa.ipaclient as ipaclient
+ import ipa.ipaadminutil as ipaadminutil
+ import ipa.ipautil as ipautil
+ import ipa.config
+
+ import errno
+ import sys
+ import xmlrpclib
+ import kerberos
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-findgroup [-a|--all] [-n|--notranslate] group"
+ print "ipa-findgroup [-a|--all] [-n|--notranslate] [-v|--verbose] group"
sys.exit()
def parse_options():
@@ -32,6 +52,8 @@ def parse_options():
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)
@@ -111,18 +133,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa.ipaclient as ipaclient
- import ipa.ipaadminutil as ipaadminutil
- import ipa.ipautil as ipautil
- import ipa.config
-
- import errno
- import sys
- import xmlrpclib
- import kerberos
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-findservice b/ipa-admintools/ipa-findservice
index fc4aa8b1..a5ae2be4 100644
--- a/ipa-admintools/ipa-findservice
+++ b/ipa-admintools/ipa-findservice
@@ -17,9 +17,29 @@
# 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
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+ import ipa.ipaadminutil as ipaadminutil
+
+ import errno
+ import sys
+ import xmlrpclib
+ import kerberos
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-findservice host"
+ print "ipa-findservice [-v|--verbose] host"
sys.exit()
def parse_options():
@@ -27,6 +47,8 @@ def parse_options():
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)
@@ -59,18 +81,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
- import ipa.ipaadminutil as ipaadminutil
-
- import errno
- import sys
- import xmlrpclib
- import kerberos
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-finduser b/ipa-admintools/ipa-finduser
index e7754cc7..c3b21778 100644
--- a/ipa-admintools/ipa-finduser
+++ b/ipa-admintools/ipa-finduser
@@ -18,8 +18,30 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+import sys
+try:
+ from optparse import OptionParser
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+ import ipa.ipaadminutil as ipaadminutil
+ import base64
+
+ import errno
+ import sys
+ import xmlrpclib
+ import kerberos
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
+
def usage():
- print "ipa-finduser [-a|--all] [-n|--notranslate] user"
+ print "ipa-finduser [-a|--all] [-n|--notranslate] [-v|--verbose] user"
sys.exit()
def parse_options():
@@ -32,6 +54,8 @@ def parse_options():
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)
@@ -66,7 +90,7 @@ def main():
if options.usage or len(args) != 2:
usage()
- client = ipaclient.IPAClient()
+ client = ipaclient.IPAClient(verbose=options.verbose)
if options.all is None:
users = client.find_users(args[1], sattrs=['uid','cn','homeDirectory','loginshell'])
else:
@@ -120,19 +144,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
- import ipa.ipaadminutil as ipaadminutil
- import base64
-
- import errno
- import sys
- import xmlrpclib
- import kerberos
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-listdelegation b/ipa-admintools/ipa-listdelegation
index 4dabc81e..b734ccb7 100644
--- a/ipa-admintools/ipa-listdelegation
+++ b/ipa-admintools/ipa-listdelegation
@@ -17,16 +17,40 @@
# 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
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+
+ import operator
+ import xmlrpclib
+ import kerberos
+ import errno
+
+ import ipa.aci
+ from ipa import ipaerror
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
aci_fields = ['*', 'aci']
def usage():
- print "ipa-listdelgation"
+ print "ipa-listdelgation [-v|--verbose]"
sys.exit(1)
def parse_options():
parser = OptionParser()
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)
@@ -74,20 +98,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
-
- import operator
- import xmlrpclib
- import kerberos
- import errno
-
- import ipa.aci
- from ipa import ipaerror
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-lockuser b/ipa-admintools/ipa-lockuser
index 6e0361fe..c11f1ea8 100644
--- a/ipa-admintools/ipa-lockuser
+++ b/ipa-admintools/ipa-lockuser
@@ -17,9 +17,28 @@
# 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
+ import ipa
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipautil as ipautil
+ import errno
+
+ import xmlrpclib
+ import kerberos
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-lockuser [-u|--unlock] user"
+ print "ipa-lockuser [-u|--unlock] [-v|--verbose] user"
sys.exit(1)
def parse_options():
@@ -28,6 +47,8 @@ def parse_options():
help="Unlock a user's account")
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)
@@ -64,17 +85,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipautil as ipautil
- import errno
-
- import xmlrpclib
- import kerberos
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-moddelegation b/ipa-admintools/ipa-moddelegation
index 1c840e16..d6b09ffb 100644
--- a/ipa-admintools/ipa-moddelegation
+++ b/ipa-admintools/ipa-moddelegation
@@ -17,12 +17,36 @@
# 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
+ import ipa
+ import ipa.ipaclient as ipaclient
+ import ipa.ipaadminutil as ipaadminutil
+ import ipa.config
+ import ipa.aci
+ import ipa.ipautil as ipautil
+
+ import xmlrpclib
+ import kerberos
+ import krbV
+ import ldap
+ import copy
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
aci_fields = ['*', 'aci']
def usage():
print "ipa-moddelegation [-l|--list]"
- print "ipa-moddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
+ print "ipa-moddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] [-v|--verbose] name"
sys.exit(1)
def parse_options():
@@ -37,6 +61,8 @@ def parse_options():
help="The target group 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)
@@ -189,22 +215,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.ipaclient as ipaclient
- import ipa.ipaadminutil as ipaadminutil
- import ipa.config
- import ipa.aci
- import ipa.ipautil as ipautil
-
- import xmlrpclib
- import kerberos
- import krbV
- import ldap
- import copy
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-modgroup b/ipa-admintools/ipa-modgroup
index a91d9a01..6905f501 100644
--- a/ipa-admintools/ipa-modgroup
+++ b/ipa-admintools/ipa-modgroup
@@ -17,12 +17,33 @@
# 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
+ import ipa
+ import ipa.group
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+ import ipa.ipaerror
+
+ import xmlrpclib
+ import kerberos
+ import ldap
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
print "ipa-modgroup [-l|--list]"
- print "ipa-modgroup [-a|--add] [-r|--remove] user group"
- print "ipa-modgroup [-g|--groupadd] [-e|--groupdel] group group"
- print "ipa-modgroup [-d|--desc description STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] group"
+ print "ipa-modgroup [-a|--add] [-r|--remove] [-v|--verbose] user group"
+ print "ipa-modgroup [-g|--groupadd] [-e|--groupdel] [-v|--verbose] group group"
+ print "ipa-modgroup [-d|--desc description STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] [-v|--verbose] group"
sys.exit(1)
def set_add_usage(which):
@@ -52,6 +73,8 @@ def parse_options():
help="List common attributes (this is not an exhaustive list)")
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)
@@ -183,19 +206,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.group
- import ipa.ipaclient as ipaclient
- import ipa.config
- import ipa.ipaerror
-
- import xmlrpclib
- import kerberos
- import ldap
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-moduser b/ipa-admintools/ipa-moduser
index 906a40f0..a9fd223e 100644
--- a/ipa-admintools/ipa-moduser
+++ b/ipa-admintools/ipa-moduser
@@ -17,10 +17,32 @@
# 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
+ import ipa
+ import ipa.user
+ import ipa.ipaclient as ipaclient
+ import ipa.ipavalidate as ipavalidate
+ import ipa.ipautil as ipautil
+ import ipa.config
+
+ import xmlrpclib
+ import kerberos
+ import ldap
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
print "ipa-moduser [--list]"
- print "ipa-moduser [-a|--activate] [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] user"
+ print "ipa-moduser [-a|--activate] [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] [-v|--verbose] user"
sys.exit(1)
def set_add_usage(which):
@@ -54,6 +76,8 @@ def parse_options():
help="Set user's e-mail address")
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)
@@ -248,20 +272,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.user
- import ipa.ipaclient as ipaclient
- import ipa.ipavalidate as ipavalidate
- import ipa.ipautil as ipautil
- import ipa.config
-
- import xmlrpclib
- import kerberos
- import ldap
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-passwd b/ipa-admintools/ipa-passwd
index 22cffca8..fc39b7f8 100644
--- a/ipa-admintools/ipa-passwd
+++ b/ipa-admintools/ipa-passwd
@@ -17,15 +17,38 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Tempal Place, Suite 330, Boston, MA 02111-1307 USA
#
+import sys
+try:
+ from optparse import OptionParser
+ import ipa
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+
+ import xmlrpclib
+ import kerberos
+ import krbV
+ import ldap
+ import getpass
+ import errno
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-passwd [user]"
+ print "ipa-passwd [-v|--verbose] [user]"
sys.exit(1)
def parse_options():
parser = OptionParser()
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)
@@ -98,19 +121,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.ipaclient as ipaclient
- import ipa.config
-
- import xmlrpclib
- import kerberos
- import krbV
- import ldap
- import getpass
- import errno
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e:
diff --git a/ipa-admintools/ipa-pwpolicy b/ipa-admintools/ipa-pwpolicy
index 481c2634..365444f3 100644
--- a/ipa-admintools/ipa-pwpolicy
+++ b/ipa-admintools/ipa-pwpolicy
@@ -17,9 +17,29 @@
# 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
+ import ipa
+ import ipa.entity
+ import ipa.ipaclient as ipaclient
+ import ipa.config
+
+ import xmlrpclib
+ import kerberos
+ import errno
+ import validate
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
def usage():
- print "ipa-pwpolicy [--maxlife days] [--minlife hours] [--history number] [--minclasses number] [--minlength number]"
+ print "ipa-pwpolicy [--maxlife days] [--minlife hours] [--history number] [--minclasses number] [--minlength number] [-v|--verbose]"
print "ipa-pwpolicy --show"
sys.exit(1)
@@ -39,6 +59,8 @@ def parse_options():
help="Show the current password policy")
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)
@@ -104,18 +126,6 @@ def main():
return 0
try:
- import sys
- from optparse import OptionParser
- import ipa
- import ipa.entity
- import ipa.ipaclient as ipaclient
- import ipa.config
-
- import xmlrpclib
- import kerberos
- import errno
- import validate
-
if __name__ == "__main__":
sys.exit(main())
except SystemExit, e: