From dee81b036642c143564364141547a7515593d480 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Jan 12 2015 03:54:51 +0000 Subject: Work around a bug in python2.6 by using simplejson (applies in EPEL6) --- diff --git a/ansible-use-simplejson.patch b/ansible-use-simplejson.patch new file mode 100644 index 0000000..1939008 --- /dev/null +++ b/ansible-use-simplejson.patch @@ -0,0 +1,18 @@ +Index: ansible-1.8.2/lib/ansible/runner/filter_plugins/core.py +=================================================================== +--- ansible-1.8.2.orig/lib/ansible/runner/filter_plugins/core.py ++++ ansible-1.8.2/lib/ansible/runner/filter_plugins/core.py +@@ -16,7 +16,12 @@ + # along with Ansible. If not, see . + + import base64 +-import json ++try: ++ # simplejson is faster and can be more up-to-date (more bugfixes) than the ++ # stdlib json. In py2.7 stdlib json is based on simplejson 2.0.9 ++ import simplejson as json ++except ImportError: ++ import json + import os.path + import yaml + import types diff --git a/ansible.spec b/ansible.spec index 1bfbcb3..e4ffa98 100644 --- a/ansible.spec +++ b/ansible.spec @@ -10,7 +10,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Name: ansible Summary: SSH-based configuration management, deployment, and task execution system Version: 1.8.2 -Release: 2%{?dist} +Release: 3%{?dist} Group: Development/Libraries License: GPLv3 @@ -18,6 +18,8 @@ Source0: http://releases.ansible.com/ansible/%{name}-%{version}.tar.gz # Patch to make ansible-vault use the forward-compat python-crypto2.6 package # Upstreamed here: https://github.com/ansible/ansible/pull/6498 Patch0: 0001-Use-setuptools-to-get-a-recent-enough-version-of-pyt.patch +# Work around for a bug in python2.6's json library by preferring simplejson +Patch1: ansible-use-simplejson.patch Url: http://ansible.com BuildArch: noarch @@ -48,6 +50,9 @@ Requires: python-setuptools # make use of this forward compat package (see the patch for ansible-vault # above to see what needs to be done.) Requires: python-crypto2.6 +# The python-2.6 stdlib json module has a bug that affects the ansible +# to_nice_json filter +Requires: python-simplejson %endif # @@ -72,6 +77,8 @@ are transferred to managed machines automatically. %if 0%{?rhel} == 6 # Patch to make ansible-vault use a newer pycrypto forward-compat package %patch0 -p1 +# Use simplejson to work around a bug in python2.6 +%patch1 -p1 %endif %build @@ -103,6 +110,9 @@ rm -rf $RPM_BUILD_ROOT %doc %{_mandir}/man1/ansible* %changelog +* Sun Jan 11 2015 Toshio Kuratomi - 1.8.2-3 +- Work around a bug in python2.6 by using simplejson (applies in EPEL6) + * Wed Dec 17 2014 Michael Scherer 1.8.2-2 - precreate /etc/ansible/roles and /usr/share/ansible_plugins