mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
start getting modules to use shared import error code (#51787)
This commit is contained in:
parent
0924a8cf67
commit
0f0d33a954
46 changed files with 230 additions and 108 deletions
|
@ -727,10 +727,13 @@ def jsonify(data, **kwargs):
|
|||
raise UnicodeError('Invalid unicode encoding encountered')
|
||||
|
||||
|
||||
def missing_required_lib(library):
|
||||
def missing_required_lib(library, reason=None):
|
||||
hostname = platform.node()
|
||||
return "Failed to import the required Python library (%s) on %s's Python %s. Please read module documentation " \
|
||||
"and install in the appropriate location." % (library, hostname, sys.executable)
|
||||
msg = "Failed to import the required Python library (%s) on %s's Python %s." % (library, hostname, sys.executable)
|
||||
if reason:
|
||||
msg += " This is required %s." % reason
|
||||
|
||||
return msg + " Please read module documentation and install in the appropriate location"
|
||||
|
||||
|
||||
class AnsibleFallbackNotFound(Exception):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue