Add Jinja2 version runtime check (#76141)

pull/76160/head
Martin Krizek 3 years ago committed by GitHub
parent 26707a3c6b
commit cc3f1d238c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,18 @@ if sys.version_info < (3, 8):
'Current version: %s' % ''.join(sys.version.splitlines()) 'Current version: %s' % ''.join(sys.version.splitlines())
) )
from importlib.metadata import version
from ansible.module_utils.compat.version import LooseVersion
# Used for determining if the system is running a new enough Jinja2 version
# and should only restrict on our documented minimum versions
jinja2_version = version('jinja2')
if jinja2_version < LooseVersion('3.0'):
raise SystemExit(
'ERROR: Ansible requires Jinja2 3.0 or newer on the controller. '
'Current version: %s' % jinja2_version
)
import errno import errno
import getpass import getpass
import os import os

Loading…
Cancel
Save