Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use packaged json module for ThreadsafeProxy #55660

Merged
merged 3 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion salt/modules/azurearm_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

# Python libs
from __future__ import absolute_import
from json import loads, dumps
from salt.utils.json import loads, dumps
import logging

# Azure libs
Expand Down
2 changes: 1 addition & 1 deletion salt/modules/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from json import JSONEncoder, loads
from salt.utils.json import JSONEncoder, loads

import salt.ext.six as six

Expand Down
2 changes: 1 addition & 1 deletion salt/modules/saltcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
import logging
import os
import time
from json import loads, dumps
from salt.utils.json import loads, dumps

# Import Salt libs
import salt.utils.files
Expand Down
4 changes: 2 additions & 2 deletions salt/netapi/rest_tornado/saltnado.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
)

salt.utils.zeromq.install_zmq()
json = salt.utils.json.import_json()
_json = salt.utils.json.import_json()
log = logging.getLogger(__name__)


Expand All @@ -233,7 +233,7 @@ def _json_dumps(obj, **kwargs):
salt.utils.json.import_json(). This ensures that we properly encode any
strings in the object before we perform the serialization.
'''
return salt.utils.json.dumps(obj, _json_module=json, **kwargs)
return salt.utils.json.dumps(obj, _json_module=_json, **kwargs)

# The clients rest_cherrypi supports. We want to mimic the interface, but not
# necessarily use the same API under the hood
Expand Down
3 changes: 1 addition & 2 deletions salt/states/netsnmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
import logging
log = logging.getLogger(__name__)

from json import loads, dumps

# salt lib
from salt.utils.json import loads, dumps
from salt.ext import six
# import NAPALM utils
import salt.utils.napalm
Expand Down
2 changes: 1 addition & 1 deletion salt/states/netusers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

# Python std lib
from copy import deepcopy
from json import loads, dumps

# salt lib
from salt.utils.json import loads, dumps
from salt.ext import six
# import NAPALM utils
import salt.utils.napalm
Expand Down
2 changes: 1 addition & 1 deletion salt/states/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
log = logging.getLogger(__name__)

from copy import deepcopy
from json import loads, dumps

# salt modules
from salt.utils.json import loads, dumps
from salt.ext import six
# import NAPALM utils
import salt.utils.napalm
Expand Down
2 changes: 1 addition & 1 deletion salt/states/zabbix_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'''
from __future__ import absolute_import, print_function, unicode_literals
from json import loads, dumps
from salt.utils.json import loads, dumps
from copy import deepcopy
from salt.ext import six

Expand Down
2 changes: 1 addition & 1 deletion salt/states/zabbix_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
from json import loads, dumps
from salt.utils.json import loads, dumps
from copy import deepcopy

# Import Salt libs
Expand Down
4 changes: 4 additions & 0 deletions salt/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
log = logging.getLogger(__name__)


# One to one mappings
JSONEncoder = json.JSONEncoder


def __split(raw):
'''
Performs a splitlines on the string. This function exists to make mocking
Expand Down