summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2018-08-10 11:13:29 -0500
committerGitHub <noreply@github.com>2018-08-10 11:13:29 -0500
commitc1c229c6d4cf74d022c56a17061ab57918822f88 (patch)
tree38f51a32506e108d65c259a4899c6edd37d2144c /contrib
parent96346938eef9594f4d1ceeff1d48f13807e36e21 (diff)
downloadansible-c1c229c6d4cf74d022c56a17061ab57918822f88.tar.gz
Remove use of simplejson throughout code base (#43548)
* Remove use of simplejson throughout code base. Fixes #42761 * Address failing tests * Remove simplejson from contrib and other outlying files * Add changelog fragment for simplejson removal
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/inventory/abiquo.py5
-rwxr-xr-xcontrib/inventory/apache-libcloud.py5
-rwxr-xr-xcontrib/inventory/brook.py5
-rwxr-xr-xcontrib/inventory/cloudforms.py5
-rwxr-xr-xcontrib/inventory/cloudstack.py7
-rwxr-xr-xcontrib/inventory/cobbler.py5
-rwxr-xr-xcontrib/inventory/collins.py5
-rwxr-xr-xcontrib/inventory/consul_io.py5
-rwxr-xr-xcontrib/inventory/digital_ocean.py5
-rwxr-xr-xcontrib/inventory/ec2.py5
-rwxr-xr-xcontrib/inventory/fleet.py5
-rwxr-xr-xcontrib/inventory/gce.py5
-rwxr-xr-xcontrib/inventory/landscape.py5
-rwxr-xr-xcontrib/inventory/linode.py5
-rwxr-xr-xcontrib/inventory/openshift.py5
-rwxr-xr-xcontrib/inventory/openstack_inventory.py5
-rwxr-xr-xcontrib/inventory/ovirt.py6
-rwxr-xr-xcontrib/inventory/ovirt4.py5
-rwxr-xr-xcontrib/inventory/packet_net.py5
-rwxr-xr-xcontrib/inventory/proxmox.py5
-rwxr-xr-xcontrib/inventory/rax.py5
-rwxr-xr-xcontrib/inventory/rudder.py5
-rwxr-xr-xcontrib/inventory/scaleway.py5
-rwxr-xr-xcontrib/inventory/serf.py5
-rwxr-xr-xcontrib/inventory/softlayer.py5
-rwxr-xr-xcontrib/inventory/spacewalk.py5
-rwxr-xr-xcontrib/inventory/ssh_config.py5
-rwxr-xr-xcontrib/inventory/stacki.py5
-rwxr-xr-xcontrib/inventory/vagrant.py5
-rwxr-xr-xcontrib/inventory/vbox.py5
-rwxr-xr-xcontrib/inventory/zabbix.py5
31 files changed, 31 insertions, 127 deletions
diff --git a/contrib/inventory/abiquo.py b/contrib/inventory/abiquo.py
index ce5fa1f3df..621ef96620 100755
--- a/contrib/inventory/abiquo.py
+++ b/contrib/inventory/abiquo.py
@@ -46,10 +46,7 @@ import sys
import time
import ConfigParser
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
from ansible.module_utils.urls import open_url
diff --git a/contrib/inventory/apache-libcloud.py b/contrib/inventory/apache-libcloud.py
index 067076fdf5..5d3fe9a2e0 100755
--- a/contrib/inventory/apache-libcloud.py
+++ b/contrib/inventory/apache-libcloud.py
@@ -42,10 +42,7 @@ from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security as sec
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
class LibcloudInventory(object):
diff --git a/contrib/inventory/brook.py b/contrib/inventory/brook.py
index 378e713fac..dc983761c0 100755
--- a/contrib/inventory/brook.py
+++ b/contrib/inventory/brook.py
@@ -84,10 +84,7 @@ try:
except ImportError:
from configparser import ConfigParser
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
try:
import libbrook
diff --git a/contrib/inventory/cloudforms.py b/contrib/inventory/cloudforms.py
index 64c300cab8..51c080d396 100755
--- a/contrib/inventory/cloudforms.py
+++ b/contrib/inventory/cloudforms.py
@@ -31,10 +31,7 @@ from requests.auth import HTTPBasicAuth
import warnings
from ansible.errors import AnsibleError
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
class CloudFormsInventory(object):
diff --git a/contrib/inventory/cloudstack.py b/contrib/inventory/cloudstack.py
index 0d5d67bb14..36ad84c520 100755
--- a/contrib/inventory/cloudstack.py
+++ b/contrib/inventory/cloudstack.py
@@ -74,12 +74,7 @@ from __future__ import print_function
import sys
import argparse
-
-try:
- import json
-except:
- import simplejson as json
-
+import json
try:
from cs import CloudStack, CloudStackException, read_config
diff --git a/contrib/inventory/cobbler.py b/contrib/inventory/cobbler.py
index 87e855faa5..eff9318967 100755
--- a/contrib/inventory/cobbler.py
+++ b/contrib/inventory/cobbler.py
@@ -65,10 +65,7 @@ import re
from time import time
import xmlrpclib
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
from six import iteritems
diff --git a/contrib/inventory/collins.py b/contrib/inventory/collins.py
index a6af0d7302..8c7b36c9bc 100755
--- a/contrib/inventory/collins.py
+++ b/contrib/inventory/collins.py
@@ -75,10 +75,7 @@ import sys
from time import time
import traceback
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
from six import iteritems
from six.moves.urllib.parse import urlencode
diff --git a/contrib/inventory/consul_io.py b/contrib/inventory/consul_io.py
index 57bad6f934..17defb435e 100755
--- a/contrib/inventory/consul_io.py
+++ b/contrib/inventory/consul_io.py
@@ -191,10 +191,7 @@ if os.getenv('ANSIBLE_INVENTORY_CONSUL_IO_LOG_ENABLED'):
setup_logging()
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
try:
import consul
diff --git a/contrib/inventory/digital_ocean.py b/contrib/inventory/digital_ocean.py
index f067876f49..eb573677a9 100755
--- a/contrib/inventory/digital_ocean.py
+++ b/contrib/inventory/digital_ocean.py
@@ -149,10 +149,7 @@ try:
except ImportError:
import configparser as ConfigParser
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
class DoManager:
diff --git a/contrib/inventory/ec2.py b/contrib/inventory/ec2.py
index 479bdf1e4e..45619c2ac3 100755
--- a/contrib/inventory/ec2.py
+++ b/contrib/inventory/ec2.py
@@ -179,10 +179,7 @@ except ImportError:
from six.moves import configparser
from collections import defaultdict
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
DEFAULTS = {
'all_elasticache_clusters': 'False',
diff --git a/contrib/inventory/fleet.py b/contrib/inventory/fleet.py
index e749aa6905..dd0d4f7168 100755
--- a/contrib/inventory/fleet.py
+++ b/contrib/inventory/fleet.py
@@ -29,10 +29,7 @@ import subprocess
import re
import string
from optparse import OptionParser
-try:
- import json
-except:
- import simplejson as json
+import json
# Options
# ------------------------------
diff --git a/contrib/inventory/gce.py b/contrib/inventory/gce.py
index 5c5773e0aa..d0285ecf17 100755
--- a/contrib/inventory/gce.py
+++ b/contrib/inventory/gce.py
@@ -101,10 +101,7 @@ else:
import logging
logging.getLogger('libcloud.common.google').addHandler(logging.NullHandler())
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
try:
from libcloud.compute.types import Provider
diff --git a/contrib/inventory/landscape.py b/contrib/inventory/landscape.py
index 4b53171c34..9aa660bef8 100755
--- a/contrib/inventory/landscape.py
+++ b/contrib/inventory/landscape.py
@@ -40,10 +40,7 @@ import sys
from landscape_api.base import API, HTTPError
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
_key = 'landscape'
diff --git a/contrib/inventory/linode.py b/contrib/inventory/linode.py
index 87198dddd2..5af8d25923 100755
--- a/contrib/inventory/linode.py
+++ b/contrib/inventory/linode.py
@@ -81,10 +81,7 @@ import sys
import argparse
from time import time
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
try:
from chube import load_chube_config
diff --git a/contrib/inventory/openshift.py b/contrib/inventory/openshift.py
index 479b8085d6..e6ba8ecfa2 100755
--- a/contrib/inventory/openshift.py
+++ b/contrib/inventory/openshift.py
@@ -28,10 +28,7 @@ version_added: None
author: Michael Scherer
'''
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
import os
import os.path
import sys
diff --git a/contrib/inventory/openstack_inventory.py b/contrib/inventory/openstack_inventory.py
index 81237a7bf2..ab2d96cb8b 100755
--- a/contrib/inventory/openstack_inventory.py
+++ b/contrib/inventory/openstack_inventory.py
@@ -59,10 +59,7 @@ import time
from distutils.version import StrictVersion
from io import StringIO
-try:
- import json
-except:
- import simplejson as json
+import json
import openstack as sdk
from openstack.cloud import inventory as sdk_inventory
diff --git a/contrib/inventory/ovirt.py b/contrib/inventory/ovirt.py
index 9ac85aae79..90729558ab 100755
--- a/contrib/inventory/ovirt.py
+++ b/contrib/inventory/ovirt.py
@@ -71,11 +71,7 @@ import argparse
import ConfigParser
from collections import defaultdict
-try:
- import json
-except ImportError:
- # noinspection PyUnresolvedReferences,PyPackageRequirements
- import simplejson as json
+import json
try:
# noinspection PyUnresolvedReferences
diff --git a/contrib/inventory/ovirt4.py b/contrib/inventory/ovirt4.py
index 33fb5b3a8a..040b33255a 100755
--- a/contrib/inventory/ovirt4.py
+++ b/contrib/inventory/ovirt4.py
@@ -70,10 +70,7 @@ try:
except ImportError:
import configparser
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
try:
import ovirtsdk4 as sdk
diff --git a/contrib/inventory/packet_net.py b/contrib/inventory/packet_net.py
index 0b1a1f5730..d919a67d80 100755
--- a/contrib/inventory/packet_net.py
+++ b/contrib/inventory/packet_net.py
@@ -55,10 +55,7 @@ except ImportError as e:
import traceback
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
ini_section = 'packet'
diff --git a/contrib/inventory/proxmox.py b/contrib/inventory/proxmox.py
index afa7032ad2..351e55da09 100755
--- a/contrib/inventory/proxmox.py
+++ b/contrib/inventory/proxmox.py
@@ -25,10 +25,7 @@
#
# { "groups": ["utility", "databases"], "a": false, "b": true }
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
import os
import sys
from optparse import OptionParser
diff --git a/contrib/inventory/rax.py b/contrib/inventory/rax.py
index 1e66d28b14..96a32c1fbb 100755
--- a/contrib/inventory/rax.py
+++ b/contrib/inventory/rax.py
@@ -155,10 +155,7 @@ import ConfigParser
from six import iteritems
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
try:
import pyrax
diff --git a/contrib/inventory/rudder.py b/contrib/inventory/rudder.py
index 4e2a119152..54bb616840 100755
--- a/contrib/inventory/rudder.py
+++ b/contrib/inventory/rudder.py
@@ -59,10 +59,7 @@ from time import time
from ansible.module_utils.six.moves import configparser
from ansible.module_utils.six.moves.urllib.parse import urlparse
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
class RudderInventory(object):
diff --git a/contrib/inventory/scaleway.py b/contrib/inventory/scaleway.py
index bf55a0e093..756af89931 100755
--- a/contrib/inventory/scaleway.py
+++ b/contrib/inventory/scaleway.py
@@ -47,10 +47,7 @@ import sys
import time
import traceback
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
EMPTY_GROUP = {
'children': [],
diff --git a/contrib/inventory/serf.py b/contrib/inventory/serf.py
index 5bdcad7f76..8a24027dd4 100755
--- a/contrib/inventory/serf.py
+++ b/contrib/inventory/serf.py
@@ -38,10 +38,7 @@ import sys
# https://pypi.org/project/serfclient/
from serfclient import SerfClient, EnvironmentConfig
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
_key = 'serf'
diff --git a/contrib/inventory/softlayer.py b/contrib/inventory/softlayer.py
index d53b6fa26d..b87d874cb0 100755
--- a/contrib/inventory/softlayer.py
+++ b/contrib/inventory/softlayer.py
@@ -36,10 +36,7 @@ import SoftLayer
import re
import argparse
import itertools
-try:
- import json
-except:
- import simplejson as json
+import json
class SoftLayerInventory(object):
diff --git a/contrib/inventory/spacewalk.py b/contrib/inventory/spacewalk.py
index 770c488bb2..3d6d00b8f5 100755
--- a/contrib/inventory/spacewalk.py
+++ b/contrib/inventory/spacewalk.py
@@ -48,13 +48,10 @@ import time
from optparse import OptionParser
import subprocess
import ConfigParser
+import json
from six import iteritems
-try:
- import json
-except:
- import simplejson as json
base_dir = os.path.dirname(os.path.realpath(__file__))
default_ini_file = os.path.join(base_dir, "spacewalk.ini")
diff --git a/contrib/inventory/ssh_config.py b/contrib/inventory/ssh_config.py
index e7195f6b1e..03c4aa3d7f 100755
--- a/contrib/inventory/ssh_config.py
+++ b/contrib/inventory/ssh_config.py
@@ -45,10 +45,7 @@ import os.path
import sys
from collections import MutableSequence
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
import paramiko
diff --git a/contrib/inventory/stacki.py b/contrib/inventory/stacki.py
index 824ecaf5e7..7af106ec9b 100755
--- a/contrib/inventory/stacki.py
+++ b/contrib/inventory/stacki.py
@@ -49,10 +49,7 @@ import sys
import yaml
from distutils.version import StrictVersion
-try:
- import json
-except:
- import simplejson as json
+import json
try:
import requests
diff --git a/contrib/inventory/vagrant.py b/contrib/inventory/vagrant.py
index 072340015e..d235ed4df8 100755
--- a/contrib/inventory/vagrant.py
+++ b/contrib/inventory/vagrant.py
@@ -40,10 +40,7 @@ import re
from paramiko import SSHConfig
from optparse import OptionParser
from collections import defaultdict
-try:
- import json
-except Exception:
- import simplejson as json
+import json
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves import StringIO
diff --git a/contrib/inventory/vbox.py b/contrib/inventory/vbox.py
index 61ecf2826a..47fe2f6923 100755
--- a/contrib/inventory/vbox.py
+++ b/contrib/inventory/vbox.py
@@ -18,10 +18,7 @@
import sys
from subprocess import Popen, PIPE
-try:
- import json
-except ImportError:
- import simplejson as json
+import json
class SetEncoder(json.JSONEncoder):
diff --git a/contrib/inventory/zabbix.py b/contrib/inventory/zabbix.py
index 0f57bff14f..86769ea778 100755
--- a/contrib/inventory/zabbix.py
+++ b/contrib/inventory/zabbix.py
@@ -49,10 +49,7 @@ except:
file=sys.stderr)
sys.exit(1)
-try:
- import json
-except:
- import simplejson as json
+import json
class ZabbixInventory(object):