From f24842fd9de3800919e0b800ca8c5f639cc32ee4 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 8 Apr 2008 14:35:26 -0400 Subject: is_integer returns the integer, don't use an if clause, just check it, if it is wrong it will just throw an exception and exit. Fix error reporting to use the canonical str(e) --- ipa-admintools/ipa-pwpolicy | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ipa-admintools/ipa-pwpolicy b/ipa-admintools/ipa-pwpolicy index 31dc242f9..481c2634f 100644 --- a/ipa-admintools/ipa-pwpolicy +++ b/ipa-admintools/ipa-pwpolicy @@ -64,25 +64,25 @@ def update_policy(client, options): try: if options.maxlife: - if validate.is_integer(options.maxlife, min=0): - new.setValue('krbmaxpwdlife', options.maxlife) + validate.is_integer(options.maxlife, min=0) + new.setValue('krbmaxpwdlife', options.maxlife) if options.minlife: - if validate.is_integer(options.minlife, min=0): - new.setValue('krbminpwdlife', options.minlife) + validate.is_integer(options.minlife, min=0) + new.setValue('krbminpwdlife', options.minlife) if options.history: - if validate.is_integer(options.history, min=0): - new.setValue('krbpwdhistorylength', options.history) + validate.is_integer(options.history, min=0) + new.setValue('krbpwdhistorylength', options.history) if options.minclasses: - if validate.is_integer(options.minclasses, min=0): - new.setValue('krbpwdmindiffchars', options.minclasses) + validate.is_integer(options.minclasses, min=0) + new.setValue('krbpwdmindiffchars', options.minclasses) if options.minlength: - if validate.is_integer(options.minlength, min=0): - new.setValue('krbpwdminlength', options.minlength) + validate.is_integer(options.minlength, min=0) + new.setValue('krbpwdminlength', options.minlength) except validate.VdtTypeError, e: - print "%s" % (e.message) + print "%s" % str(e) return 1 except validate.VdtValueTooSmallError, e: - print "%s" % (e.message) + print "%s" % str(e) return 1 client.update_password_policy(new) -- cgit