Add helper function to return helpful import error msg (#47409)

This commit is contained in:
Jordan Borean 2018-10-24 07:21:36 +10:00 committed by GitHub
parent f28b7c7ab1
commit ddfd1dbfc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 15 deletions

View file

@ -785,6 +785,12 @@ def jsonify(data, **kwargs):
raise UnicodeError('Invalid unicode encoding encountered')
def missing_required_lib(library):
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)
class AnsibleFallbackNotFound(Exception):
pass