summaryrefslogtreecommitdiffstats
path: root/ipa-admintools/ipa-pwpolicy
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/ipa-pwpolicy
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/ipa-pwpolicy')
-rw-r--r--ipa-admintools/ipa-pwpolicy36
1 files changed, 23 insertions, 13 deletions
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: