mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Update for modules which import json.
Some do not use the json module directly so don't need import json. Some needed to fallback to simplejson with no traceback if neither was installed Fixes #1298
This commit is contained in:
committed by
Matt Clay
parent
db051ff9d2
commit
ad0d2c1747
@@ -128,7 +128,12 @@ import re
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
# Let snippet from module_utils/basic.py return a proper error in this case
|
||||
pass
|
||||
|
||||
|
||||
def parse_out(string):
|
||||
return re.sub("\s+", " ", string).strip()
|
||||
|
||||
@@ -107,7 +107,12 @@ import os
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
# Let snippet from module_utils/basic.py return a proper error in this case
|
||||
pass
|
||||
|
||||
|
||||
class Npm(object):
|
||||
def __init__(self, module, **kwargs):
|
||||
|
||||
@@ -109,7 +109,6 @@ EXAMPLES = '''
|
||||
- pacman: name=baz state=absent force=yes
|
||||
'''
|
||||
|
||||
import json
|
||||
import shlex
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -63,7 +63,6 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
import json
|
||||
import shlex
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -85,7 +85,6 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
import json
|
||||
import shlex
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -58,7 +58,6 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
import json
|
||||
import shlex
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -73,7 +73,6 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
import json
|
||||
import shlex
|
||||
import os
|
||||
import sys
|
||||
|
||||
Reference in New Issue
Block a user