diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-11-15 17:05:55 -0500 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2010-11-18 15:13:22 -0500 |
commit | 151059b0e7157f9d326a1a27367073cc425833a4 (patch) | |
tree | 680656ac9b28ed0dd23784718a969d4f273ec890 /ipalib/plugins/pwpolicy.py | |
parent | 345fc79f039d217316c5d2df5ef59952a8130a96 (diff) | |
download | freeipa-151059b0e7157f9d326a1a27367073cc425833a4.tar.gz freeipa-151059b0e7157f9d326a1a27367073cc425833a4.tar.xz freeipa-151059b0e7157f9d326a1a27367073cc425833a4.zip |
Use distutil.version to check for min version
Diffstat (limited to 'ipalib/plugins/pwpolicy.py')
-rw-r--r-- | ipalib/plugins/pwpolicy.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py index 53989def3..7a83216f3 100644 --- a/ipalib/plugins/pwpolicy.py +++ b/ipalib/plugins/pwpolicy.py @@ -64,6 +64,7 @@ from ipalib import Int, Str from ipalib.plugins.baseldap import * from ipalib import _ from ipapython.ipautil import run +from distutils import version class cosentry(LDAPObject): """ @@ -171,12 +172,17 @@ class pwpolicy(LDAPObject): 'krbpwdmaxfailure', 'krbpwdfailurecountinterval', 'krbpwdlockoutduration', ] + MIN_KRB5KDC_WITH_LOCKOUT = "1.8" has_lockout = False lockout_params = () + (stdout, stderr, rc) = run(['klist', '-V'], raiseonerr=False) if rc == 0: - if stdout.find('version 1.8') > -1: - has_lockout = True + verstr = stdout.split()[-1] + ver = version.LooseVersion(verstr) + min = version.LooseVersion(MIN_KRB5KDC_WITH_LOCKOUT) + if ver >= min: + has_lockout = True if has_lockout: lockout_params = ( |