mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
now ansible shows nice message about missing json instead of traceback
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
This commit is contained in:
parent
7749b34546
commit
46c913f7a6
1 changed files with 9 additions and 5 deletions
|
@ -51,11 +51,6 @@ BOOLEANS = BOOLEANS_TRUE + BOOLEANS_FALSE
|
||||||
# of an ansible module. The source of this common code lives
|
# of an ansible module. The source of this common code lives
|
||||||
# in lib/ansible/module_common.py
|
# in lib/ansible/module_common.py
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
import base64
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
|
@ -72,6 +67,15 @@ import pwd
|
||||||
import platform
|
import platform
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
|
try:
|
||||||
|
import json
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
|
sys.stderr.write('Error: ansible requires a json module, none found!')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
HAVE_SELINUX=False
|
HAVE_SELINUX=False
|
||||||
try:
|
try:
|
||||||
import selinux
|
import selinux
|
||||||
|
|
Loading…
Reference in a new issue