fix: `COLOR_INCLUDED` to colorize `included` output (#83711)

adds color included configuration and applies to include message

Co-authored-by: Achille Myette <amyette@drw.com>
pull/81929/merge
akire0ne 4 months ago committed by GitHub
parent e4d7286298
commit 7b74de069c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,4 @@
bugfixes:
- COLOR_SKIP will not alter "included" events color display anymore.
minor_changes:
- Introducing COLOR_INCLUDED parameter. This can set a specific color for "included" events.

@ -304,6 +304,14 @@ COLOR_HIGHLIGHT:
env: [{name: ANSIBLE_COLOR_HIGHLIGHT}] env: [{name: ANSIBLE_COLOR_HIGHLIGHT}]
ini: ini:
- {key: highlight, section: colors} - {key: highlight, section: colors}
COLOR_INCLUDED:
name: Color for 'included' task status
default: cyan
description: Defines the color to use when showing 'Included' task status.
env: [{name: ANSIBLE_COLOR_INCLUDED}]
ini:
- {key: included, section: colors}
version_added: '2.18'
COLOR_OK: COLOR_OK:
name: Color for 'ok' task status name: Color for 'ok' task status
default: green default: green

@ -293,7 +293,7 @@ class CallbackModule(CallbackBase):
label = self._get_item_label(included_file._vars) label = self._get_item_label(included_file._vars)
if label: if label:
msg += " => (item=%s)" % label msg += " => (item=%s)" % label
self._display.display(msg, color=C.COLOR_SKIP) self._display.display(msg, color=C.COLOR_INCLUDED)
def v2_playbook_on_stats(self, stats): def v2_playbook_on_stats(self, stats):
self._display.banner("PLAY RECAP") self._display.banner("PLAY RECAP")

@ -172,6 +172,7 @@ if getattr(C, 'DEFAULT_LOG_PATH'):
color_to_log_level = {C.COLOR_DEBUG: logging.DEBUG, color_to_log_level = {C.COLOR_DEBUG: logging.DEBUG,
C.COLOR_VERBOSE: logging.INFO, C.COLOR_VERBOSE: logging.INFO,
C.COLOR_OK: logging.INFO, C.COLOR_OK: logging.INFO,
C.COLOR_INCLUDED: logging.INFO,
C.COLOR_CHANGED: logging.INFO, C.COLOR_CHANGED: logging.INFO,
C.COLOR_SKIP: logging.WARNING, C.COLOR_SKIP: logging.WARNING,
C.COLOR_DEPRECATE: logging.WARNING, C.COLOR_DEPRECATE: logging.WARNING,

Loading…
Cancel
Save