summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Gedminas <marius@gedmin.as>2015-09-30 09:08:41 +0300
committerMarius Gedminas <marius@gedmin.as>2015-09-30 18:40:47 +0300
commit9f3e5ceb14cbec68561433a820de87a8954adc7b (patch)
tree977fc235a7a3602e2ea636ffdf55903efb2c3665
parentf7571cb37fcfb854abc8174fc721f8b474191ff2 (diff)
downloadansible-9f3e5ceb14cbec68561433a820de87a8954adc7b.tar.gz
Make sure 'basestring', 'bytes' and 'unicode' are defined
Python 3 doesn't have 'basestring' and 'unicode'. Python 2.4 doesn't have 'bytes'
-rw-r--r--lib/ansible/module_utils/basic.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 582aa35e3b..0995fdd758 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -74,6 +74,22 @@ except ImportError:
imap = map # Python 3
try:
+ basestring
+except NameError:
+ basestring = str # Python 3
+
+try:
+ unicode
+except NameError:
+ unicode = str # Python 3
+
+try:
+ bytes
+except NameError:
+ bytes = str # Python 2
+
+
+try:
import json
# Detect the python-json library which is incompatible
# Look for simplejson if that's the case