Disable jinja2_native warning in CI (#75214)

pull/75256/head
Martin Krizek 3 years ago committed by GitHub
parent 93e72c96f0
commit 8ab418f41b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Introduce a config option to enable/disable emitting warning about Jinja2 version being old for ``jinja2_native``. The option is on by default, only in CI it is off.

@ -1632,6 +1632,15 @@ MAX_FILE_SIZE_FOR_DIFF:
ini:
- {key: max_diff_size, section: defaults}
type: int
JINJA2_NATIVE_WARNING:
name: Running older than required Jinja version for jinja2_native warning
default: True
description: Toggle to control showing warnings related to running a Jinja version
older than required for jinja2_native
env: [{name: ANSIBLE_JINJA2_NATIVE_WARNING}]
ini:
- {key: jinja2_native_warning, section: defaults}
type: boolean
NETWORK_GROUP_MODULES:
name: Network module families
default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, onyx, netconf, exos, voss, slxos]

@ -95,10 +95,11 @@ if C.DEFAULT_JINJA2_NATIVE:
except ImportError:
from jinja2 import Environment
from jinja2.utils import concat as j2_concat
display.warning(
'jinja2_native requires Jinja 2.10 and above. '
'Version detected: %s. Falling back to default.' % j2_version
)
if C.JINJA2_NATIVE_WARNING:
display.warning(
'jinja2_native requires Jinja 2.10 and above. '
'Version detected: %s. Falling back to default.' % j2_version
)
JINJA2_BEGIN_TOKENS = frozenset(('variable_begin', 'block_begin', 'comment_begin', 'raw_begin'))

@ -81,6 +81,7 @@ def ansible_environment(args, color=True, ansible_config=None):
ANSIBLE_LIBRARY='/dev/null',
ANSIBLE_DEVEL_WARNING='false', # Don't show warnings that CI is running devel
ANSIBLE_CONTROLLER_PYTHON_WARNING='false', # Don't show warnings in CI for old controller Python
ANSIBLE_JINJA2_NATIVE_WARNING='false', # Don't show warnings in CI for old Jinja for native
PYTHONPATH=get_ansible_python_path(args),
PAGER='/bin/cat',
PATH=path,

Loading…
Cancel
Save