summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2017-06-22 13:46:05 -0400
committerBrian Coca <brian.coca+git@gmail.com>2017-06-22 13:46:05 -0400
commitc26cbc5a9fe0e4b7a329bc84585cef2faffcb8a3 (patch)
tree417243267906b91a50fbbee5991d7e25ce806c56
parent6d121de1036a568b765b90e6a0e177dae97b15ab (diff)
downloadansible-modules-core-stable-2.2.tar.gz
backport of htpasswd fix from @jamesbraidstable-2.2
see https://github.com/ansible/ansible/pull/20202
-rw-r--r--web_infrastructure/htpasswd.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/web_infrastructure/htpasswd.py b/web_infrastructure/htpasswd.py
index f1a4e482..e515180d 100644
--- a/web_infrastructure/htpasswd.py
+++ b/web_infrastructure/htpasswd.py
@@ -84,7 +84,7 @@ EXAMPLES = """
import os
import tempfile
-from distutils.version import StrictVersion
+from distutils.version import LooseVersion
try:
from passlib.apache import HtpasswdFile, htpasswd_context
@@ -118,7 +118,7 @@ def present(dest, username, password, crypt_scheme, create, check_mode):
if check_mode:
return ("Create %s" % dest, True)
create_missing_directories(dest)
- if StrictVersion(passlib.__version__) >= StrictVersion('1.6'):
+ if LooseVersion(passlib.__version__) >= LooseVersion('1.6'):
ht = HtpasswdFile(dest, new=True, default_scheme=crypt_scheme, context=context)
else:
ht = HtpasswdFile(dest, autoload=False, default=crypt_scheme, context=context)
@@ -129,7 +129,7 @@ def present(dest, username, password, crypt_scheme, create, check_mode):
ht.save()
return ("Created %s and added %s" % (dest, username), True)
else:
- if StrictVersion(passlib.__version__) >= StrictVersion('1.6'):
+ if LooseVersion(passlib.__version__) >= LooseVersion('1.6'):
ht = HtpasswdFile(dest, new=False, default_scheme=crypt_scheme, context=context)
else:
ht = HtpasswdFile(dest, default=crypt_scheme, context=context)
@@ -156,7 +156,7 @@ def absent(dest, username, check_mode):
""" Ensures user is absent
Returns (msg, changed) """
- if StrictVersion(passlib.__version__) >= StrictVersion('1.6'):
+ if LooseVersion(passlib.__version__) >= LooseVersion('1.6'):
ht = HtpasswdFile(dest, new=False)
else:
ht = HtpasswdFile(dest)