summaryrefslogtreecommitdiff
path: root/monitoring/sensu_check.py
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2016-01-11 12:47:21 -0800
committerToshio Kuratomi <toshio@fedoraproject.org>2016-01-11 13:06:22 -0800
commitd6af6f8477d3d1600f3907d4ec1b216c94e67d52 (patch)
treef0fe4574d56af1193c4a2c835bf4ac7caad2375d /monitoring/sensu_check.py
parent39c3004337b688cd44e711f6eeeb9bc161f0d318 (diff)
downloadansible-modules-extras-json-imports-fallback.tar.gz
Update for modules which import json.json-imports-fallback
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
Diffstat (limited to 'monitoring/sensu_check.py')
-rw-r--r--monitoring/sensu_check.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/monitoring/sensu_check.py b/monitoring/sensu_check.py
index 9a004d37..09edae63 100644
--- a/monitoring/sensu_check.py
+++ b/monitoring/sensu_check.py
@@ -174,16 +174,20 @@ EXAMPLES = '''
sensu_check: name=check_disk_capacity state=absent
'''
+try:
+ import json
+except ImportError:
+ try:
+ import simplejson as json
+ except ImportError:
+ # Let snippet from module_utils/basic.py return a proper error in this case
+ pass
+
def sensu_check(module, path, name, state='present', backup=False):
changed = False
reasons = []
- try:
- import json
- except ImportError:
- import simplejson as json
-
stream = None
try:
try: