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
edc27c5a
Commit
edc27c5a
authored
Jan 12, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix to_nice_json on python2.6
parent
f995b346
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
lib/ansible/runner/action_plugins/unarchive.py
+0
-0
lib/ansible/runner/filter_plugins/core.py
+23
-4
No files found.
lib/ansible/runner/action_plugins/unarchive.py
View file @
edc27c5a
lib/ansible/runner/filter_plugins/core.py
View file @
edc27c5a
...
...
@@ -15,21 +15,24 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import
sys
import
base64
import
json
import
os.path
import
yaml
import
types
import
pipes
import
glob
import
re
import
collections
import
operator
as
py_operator
from
ansible
import
errors
from
ansible.utils
import
md5s
,
checksum_s
from
distutils.version
import
LooseVersion
,
StrictVersion
from
random
import
SystemRandom
,
shuffle
import
yaml
from
jinja2.filters
import
environmentfilter
from
distutils.version
import
LooseVersion
,
StrictVersion
from
ansible
import
errors
from
ansible.utils
import
md5s
,
checksum_s
def
to_nice_yaml
(
*
a
,
**
kw
):
...
...
@@ -42,6 +45,22 @@ def to_json(a, *args, **kw):
def
to_nice_json
(
a
,
*
args
,
**
kw
):
'''Make verbose, human readable JSON'''
# python-2.6's json encoder is buggy (can't encode hostvars)
if
sys
.
version_info
<
(
2
,
7
):
try
:
import
simplejson
except
ImportError
:
pass
else
:
try
:
major
=
int
(
simplejson
.
__version__
.
split
(
'.'
)[
0
])
except
:
pass
else
:
if
major
>=
2
:
return
simplejson
.
dumps
(
a
,
indent
=
4
,
sort_keys
=
True
,
*
args
,
**
kw
)
# Fallback to the to_json filter
return
to_json
(
a
,
*
args
,
**
kw
)
return
json
.
dumps
(
a
,
indent
=
4
,
sort_keys
=
True
,
*
args
,
**
kw
)
def
failed
(
*
a
,
**
kw
):
...
...
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