diff options
author | Simo Sorce <ssorce@redhat.com> | 2008-04-08 14:35:26 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2008-04-08 14:35:26 -0400 |
commit | f24842fd9de3800919e0b800ca8c5f639cc32ee4 (patch) | |
tree | 1541ebc1be870ab73f2e8d8bbde4952dcaf09376 | |
parent | 3ec54383f9e3a0d510c993546915310da79335a9 (diff) | |
download | freeipa.git-f24842fd9de3800919e0b800ca8c5f639cc32ee4.tar.gz freeipa.git-f24842fd9de3800919e0b800ca8c5f639cc32ee4.tar.xz freeipa.git-f24842fd9de3800919e0b800ca8c5f639cc32ee4.zip |
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)
-rw-r--r-- | ipa-admintools/ipa-pwpolicy | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ipa-admintools/ipa-pwpolicy b/ipa-admintools/ipa-pwpolicy index 31dc242f..481c2634 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) |