Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
122c53ba
Commit
122c53ba
authored
Jul 20, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect the old python-json library
Fixes #11654
parent
c86e55dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
lib/ansible/module_utils/basic.py
+9
-2
lib/ansible/module_utils/facts.py
+9
-0
No files found.
lib/ansible/module_utils/basic.py
View file @
122c53ba
...
...
@@ -70,14 +70,21 @@ import tempfile
try
:
import
json
# Detect the python-json library which is incompatible
# Look for simplejson if that's the case
try
:
if
not
isinstance
(
json
.
loads
,
types
.
FunctionType
)
or
not
isinstance
(
json
.
dumps
,
types
.
FunctionType
):
raise
ImportError
except
AttributeError
:
raise
ImportError
except
ImportError
:
try
:
import
simplejson
as
json
except
ImportError
:
sys
.
stderr
.
write
(
'Error: ansible requires a json module, none found!
'
)
print
(
'{"msg": "Error: ansible requires the stdlib json or simplejson module, neither was found!", "failed": true}
'
)
sys
.
exit
(
1
)
except
SyntaxError
:
sys
.
stderr
.
write
(
'SyntaxError: probably due to json and python being for different versions
'
)
print
(
'{"msg": "SyntaxError: probably due to installed simplejson being for a different python version", "failed": true}
'
)
sys
.
exit
(
1
)
HAVE_SELINUX
=
False
...
...
lib/ansible/module_utils/facts.py
View file @
122c53ba
...
...
@@ -16,6 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import
os
import
sys
import
stat
import
array
import
errno
...
...
@@ -43,9 +44,17 @@ except ImportError:
try
:
import
json
# Detect python-json which is incompatible and fallback to simplejson in
# that case
try
:
json
.
loads
json
.
dumps
except
AttributeError
:
raise
ImportError
except
ImportError
:
import
simplejson
as
json
# --------------------------------------------------------------
# timeout function to make sure some fact gathering
# steps do not exceed a time limit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment