mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Merge pull request #5815 from ryanpetrello/fix-cli-settings-py2
fix a py2/py3 compat bug in the settings CLI Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import functools
|
import functools
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from six import with_metaclass
|
from six import with_metaclass, PY3
|
||||||
|
|
||||||
from .stdout import monitor, monitor_workflow
|
from .stdout import monitor, monitor_workflow
|
||||||
from .utils import CustomRegistryMeta, color_enabled
|
from .utils import CustomRegistryMeta, color_enabled
|
||||||
@@ -547,8 +547,11 @@ class SettingsModify(CustomAction):
|
|||||||
return resp.from_json({'key': key, 'value': resp[key]})
|
return resp.from_json({'key': key, 'value': resp[key]})
|
||||||
|
|
||||||
def is_json(self, data):
|
def is_json(self, data):
|
||||||
|
err = ValueError
|
||||||
|
if PY3:
|
||||||
|
err = json.decoder.JSONDecodeError
|
||||||
try:
|
try:
|
||||||
json.loads(data)
|
json.loads(data)
|
||||||
except json.decoder.JSONDecodeError:
|
except err:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user