| 1 |
# Copyright (c) 2019, Trevor Highfill <[email protected]> |
| 2 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 3 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
from __future__ import annotations |
| 6 |
|
| 7 |
DOCUMENTATION = r""" |
| 8 |
name: diy |
| 9 |
type: stdout |
| 10 |
short_description: Customize the output |
| 11 |
version_added: 0.2.0 |
| 12 |
description: |
| 13 |
- Callback plugin that allows you to supply your own custom callback templates to be output. |
| 14 |
author: Trevor Highfill (@theque5t) |
| 15 |
extends_documentation_fragment: |
| 16 |
- ansible.builtin.default_callback |
| 17 |
notes: |
| 18 |
- Uses the P(ansible.builtin.default#callback) callback plugin output when a custom callback V(message(msg\)) is not provided. |
| 19 |
- Makes the callback event data available using the C(ansible_callback_diy) dictionary, which can be used in the templating |
| 20 |
context for the options. The dictionary is only available in the templating context for the options. It is not a variable |
| 21 |
that is available using the other various execution contexts, such as playbook, play, task, and so on so forth. |
| 22 |
- Options being set by their respective variable input can only be set using the variable if the variable was set in a context |
| 23 |
that is available to the respective callback. Use the C(ansible_callback_diy) dictionary to see what is available to a |
| 24 |
callback. Additionally, C(ansible_callback_diy.top_level_var_names) outputs the top level variable names available |
| 25 |
to the callback. |
| 26 |
- Each option value is rendered as a template before being evaluated. This allows for the dynamic usage of an option. For |
| 27 |
example, V("{{ 'yellow' if ansible_callback_diy.result.is_changed else 'bright green' }}"). |
| 28 |
- 'B(Condition) for all C(msg) options: if value V(is None or omit), then the option is not being used. B(Effect): use of |
| 29 |
the C(default) callback plugin for output.' |
| 30 |
- 'B(Condition) for all C(msg) options: if value V(is not None and not omit and length is not greater than 0), then the |
| 31 |
option is being used without output. B(Effect): suppress output.' |
| 32 |
- 'B(Condition) for all C(msg) options: if value V(is not None and not omit and length is greater than 0), then the option |
| 33 |
is being used with output. B(Effect): render value as template and output.' |
| 34 |
- 'Valid color values: V(black), V(bright gray), V(blue), V(white), V(green), V(bright blue), V(cyan), V(bright green), |
| 35 |
V(red), V(bright cyan), V(purple), V(bright red), V(yellow), V(bright purple), V(dark gray), V(bright yellow), V(magenta), |
| 36 |
V(bright magenta), V(normal).' |
| 37 |
seealso: |
| 38 |
- name: default – default Ansible screen output |
| 39 |
description: The official documentation on the B(default) callback plugin. |
| 40 |
link: https://docs.ansible.com/projects/ansible/latest/plugins/callback/default.html |
| 41 |
requirements: |
| 42 |
- set as stdout_callback in configuration |
| 43 |
options: |
| 44 |
on_any_msg: |
| 45 |
description: Output to be used for callback on_any. |
| 46 |
ini: |
| 47 |
- section: callback_diy |
| 48 |
key: on_any_msg |
| 49 |
env: |
| 50 |
- name: ANSIBLE_CALLBACK_DIY_ON_ANY_MSG |
| 51 |
vars: |
| 52 |
- name: ansible_callback_diy_on_any_msg |
| 53 |
type: str |
| 54 |
|
| 55 |
on_any_msg_color: |
| 56 |
description: |
| 57 |
- Output color to be used for O(on_any_msg). |
| 58 |
- Template should render a L(valid color value,#notes). |
| 59 |
ini: |
| 60 |
- section: callback_diy |
| 61 |
key: on_any_msg_color |
| 62 |
env: |
| 63 |
- name: ANSIBLE_CALLBACK_DIY_ON_ANY_MSG_COLOR |
| 64 |
vars: |
| 65 |
- name: ansible_callback_diy_on_any_msg_color |
| 66 |
type: str |
| 67 |
|
| 68 |
runner_on_failed_msg: |
| 69 |
description: Output to be used for callback runner_on_failed. |
| 70 |
ini: |
| 71 |
- section: callback_diy |
| 72 |
key: runner_on_failed_msg |
| 73 |
env: |
| 74 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_FAILED_MSG |
| 75 |
vars: |
| 76 |
- name: ansible_callback_diy_runner_on_failed_msg |
| 77 |
type: str |
| 78 |
|
| 79 |
runner_on_failed_msg_color: |
| 80 |
description: |
| 81 |
- Output color to be used for O(runner_on_failed_msg). |
| 82 |
- Template should render a L(valid color value,#notes). |
| 83 |
ini: |
| 84 |
- section: callback_diy |
| 85 |
key: runner_on_failed_msg_color |
| 86 |
env: |
| 87 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_FAILED_MSG_COLOR |
| 88 |
vars: |
| 89 |
- name: ansible_callback_diy_runner_on_failed_msg_color |
| 90 |
type: str |
| 91 |
|
| 92 |
runner_on_ok_msg: |
| 93 |
description: Output to be used for callback runner_on_ok. |
| 94 |
ini: |
| 95 |
- section: callback_diy |
| 96 |
key: runner_on_ok_msg |
| 97 |
env: |
| 98 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_OK_MSG |
| 99 |
vars: |
| 100 |
- name: ansible_callback_diy_runner_on_ok_msg |
| 101 |
type: str |
| 102 |
|
| 103 |
runner_on_ok_msg_color: |
| 104 |
description: |
| 105 |
- Output color to be used for O(runner_on_ok_msg). |
| 106 |
- Template should render a L(valid color value,#notes). |
| 107 |
ini: |
| 108 |
- section: callback_diy |
| 109 |
key: runner_on_ok_msg_color |
| 110 |
env: |
| 111 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_OK_MSG_COLOR |
| 112 |
vars: |
| 113 |
- name: ansible_callback_diy_runner_on_ok_msg_color |
| 114 |
type: str |
| 115 |
|
| 116 |
runner_on_skipped_msg: |
| 117 |
description: Output to be used for callback runner_on_skipped. |
| 118 |
ini: |
| 119 |
- section: callback_diy |
| 120 |
key: runner_on_skipped_msg |
| 121 |
env: |
| 122 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_SKIPPED_MSG |
| 123 |
vars: |
| 124 |
- name: ansible_callback_diy_runner_on_skipped_msg |
| 125 |
type: str |
| 126 |
|
| 127 |
runner_on_skipped_msg_color: |
| 128 |
description: |
| 129 |
- Output color to be used for O(runner_on_skipped_msg). |
| 130 |
- Template should render a L(valid color value,#notes). |
| 131 |
ini: |
| 132 |
- section: callback_diy |
| 133 |
key: runner_on_skipped_msg_color |
| 134 |
env: |
| 135 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_SKIPPED_MSG_COLOR |
| 136 |
vars: |
| 137 |
- name: ansible_callback_diy_runner_on_skipped_msg_color |
| 138 |
type: str |
| 139 |
|
| 140 |
runner_on_unreachable_msg: |
| 141 |
description: Output to be used for callback runner_on_unreachable. |
| 142 |
ini: |
| 143 |
- section: callback_diy |
| 144 |
key: runner_on_unreachable_msg |
| 145 |
env: |
| 146 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_UNREACHABLE_MSG |
| 147 |
vars: |
| 148 |
- name: ansible_callback_diy_runner_on_unreachable_msg |
| 149 |
type: str |
| 150 |
|
| 151 |
runner_on_unreachable_msg_color: |
| 152 |
description: |
| 153 |
- Output color to be used for O(runner_on_unreachable_msg). |
| 154 |
- Template should render a L(valid color value,#notes). |
| 155 |
ini: |
| 156 |
- section: callback_diy |
| 157 |
key: runner_on_unreachable_msg_color |
| 158 |
env: |
| 159 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_UNREACHABLE_MSG_COLOR |
| 160 |
vars: |
| 161 |
- name: ansible_callback_diy_runner_on_unreachable_msg_color |
| 162 |
type: str |
| 163 |
|
| 164 |
playbook_on_start_msg: |
| 165 |
description: Output to be used for callback playbook_on_start. |
| 166 |
ini: |
| 167 |
- section: callback_diy |
| 168 |
key: playbook_on_start_msg |
| 169 |
env: |
| 170 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_START_MSG |
| 171 |
vars: |
| 172 |
- name: ansible_callback_diy_playbook_on_start_msg |
| 173 |
type: str |
| 174 |
|
| 175 |
playbook_on_start_msg_color: |
| 176 |
description: |
| 177 |
- Output color to be used for O(playbook_on_start_msg). |
| 178 |
- Template should render a L(valid color value,#notes). |
| 179 |
ini: |
| 180 |
- section: callback_diy |
| 181 |
key: playbook_on_start_msg_color |
| 182 |
env: |
| 183 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_START_MSG_COLOR |
| 184 |
vars: |
| 185 |
- name: ansible_callback_diy_playbook_on_start_msg_color |
| 186 |
type: str |
| 187 |
|
| 188 |
playbook_on_notify_msg: |
| 189 |
description: Output to be used for callback playbook_on_notify. |
| 190 |
ini: |
| 191 |
- section: callback_diy |
| 192 |
key: playbook_on_notify_msg |
| 193 |
env: |
| 194 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NOTIFY_MSG |
| 195 |
vars: |
| 196 |
- name: ansible_callback_diy_playbook_on_notify_msg |
| 197 |
type: str |
| 198 |
|
| 199 |
playbook_on_notify_msg_color: |
| 200 |
description: |
| 201 |
- Output color to be used for O(playbook_on_notify_msg). |
| 202 |
- Template should render a L(valid color value,#notes). |
| 203 |
ini: |
| 204 |
- section: callback_diy |
| 205 |
key: playbook_on_notify_msg_color |
| 206 |
env: |
| 207 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NOTIFY_MSG_COLOR |
| 208 |
vars: |
| 209 |
- name: ansible_callback_diy_playbook_on_notify_msg_color |
| 210 |
type: str |
| 211 |
|
| 212 |
playbook_on_no_hosts_matched_msg: |
| 213 |
description: Output to be used for callback playbook_on_no_hosts_matched. |
| 214 |
ini: |
| 215 |
- section: callback_diy |
| 216 |
key: playbook_on_no_hosts_matched_msg |
| 217 |
env: |
| 218 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_MATCHED_MSG |
| 219 |
vars: |
| 220 |
- name: ansible_callback_diy_playbook_on_no_hosts_matched_msg |
| 221 |
type: str |
| 222 |
|
| 223 |
playbook_on_no_hosts_matched_msg_color: |
| 224 |
description: |
| 225 |
- Output color to be used for O(playbook_on_no_hosts_matched_msg). |
| 226 |
- Template should render a L(valid color value,#notes). |
| 227 |
ini: |
| 228 |
- section: callback_diy |
| 229 |
key: playbook_on_no_hosts_matched_msg_color |
| 230 |
env: |
| 231 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_MATCHED_MSG_COLOR |
| 232 |
vars: |
| 233 |
- name: ansible_callback_diy_playbook_on_no_hosts_matched_msg_color |
| 234 |
type: str |
| 235 |
|
| 236 |
playbook_on_no_hosts_remaining_msg: |
| 237 |
description: Output to be used for callback playbook_on_no_hosts_remaining. |
| 238 |
ini: |
| 239 |
- section: callback_diy |
| 240 |
key: playbook_on_no_hosts_remaining_msg |
| 241 |
env: |
| 242 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_REMAINING_MSG |
| 243 |
vars: |
| 244 |
- name: ansible_callback_diy_playbook_on_no_hosts_remaining_msg |
| 245 |
type: str |
| 246 |
|
| 247 |
playbook_on_no_hosts_remaining_msg_color: |
| 248 |
description: |
| 249 |
- Output color to be used for O(playbook_on_no_hosts_remaining_msg). |
| 250 |
- Template should render a L(valid color value,#notes). |
| 251 |
ini: |
| 252 |
- section: callback_diy |
| 253 |
key: playbook_on_no_hosts_remaining_msg_color |
| 254 |
env: |
| 255 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_REMAINING_MSG_COLOR |
| 256 |
vars: |
| 257 |
- name: ansible_callback_diy_playbook_on_no_hosts_remaining_msg_color |
| 258 |
type: str |
| 259 |
|
| 260 |
playbook_on_task_start_msg: |
| 261 |
description: Output to be used for callback playbook_on_task_start. |
| 262 |
ini: |
| 263 |
- section: callback_diy |
| 264 |
key: playbook_on_task_start_msg |
| 265 |
env: |
| 266 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_TASK_START_MSG |
| 267 |
vars: |
| 268 |
- name: ansible_callback_diy_playbook_on_task_start_msg |
| 269 |
type: str |
| 270 |
|
| 271 |
playbook_on_task_start_msg_color: |
| 272 |
description: |
| 273 |
- Output color to be used for O(playbook_on_task_start_msg). |
| 274 |
- Template should render a L(valid color value,#notes). |
| 275 |
ini: |
| 276 |
- section: callback_diy |
| 277 |
key: playbook_on_task_start_msg_color |
| 278 |
env: |
| 279 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_TASK_START_MSG_COLOR |
| 280 |
vars: |
| 281 |
- name: ansible_callback_diy_playbook_on_task_start_msg_color |
| 282 |
type: str |
| 283 |
|
| 284 |
playbook_on_handler_task_start_msg: |
| 285 |
description: Output to be used for callback playbook_on_handler_task_start. |
| 286 |
ini: |
| 287 |
- section: callback_diy |
| 288 |
key: playbook_on_handler_task_start_msg |
| 289 |
env: |
| 290 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_HANDLER_TASK_START_MSG |
| 291 |
vars: |
| 292 |
- name: ansible_callback_diy_playbook_on_handler_task_start_msg |
| 293 |
type: str |
| 294 |
|
| 295 |
playbook_on_handler_task_start_msg_color: |
| 296 |
description: |
| 297 |
- Output color to be used for O(playbook_on_handler_task_start_msg). |
| 298 |
- Template should render a L(valid color value,#notes). |
| 299 |
ini: |
| 300 |
- section: callback_diy |
| 301 |
key: playbook_on_handler_task_start_msg_color |
| 302 |
env: |
| 303 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_HANDLER_TASK_START_MSG_COLOR |
| 304 |
vars: |
| 305 |
- name: ansible_callback_diy_playbook_on_handler_task_start_msg_color |
| 306 |
type: str |
| 307 |
|
| 308 |
playbook_on_vars_prompt_msg: |
| 309 |
description: Output to be used for callback playbook_on_vars_prompt. |
| 310 |
ini: |
| 311 |
- section: callback_diy |
| 312 |
key: playbook_on_vars_prompt_msg |
| 313 |
env: |
| 314 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_VARS_PROMPT_MSG |
| 315 |
vars: |
| 316 |
- name: ansible_callback_diy_playbook_on_vars_prompt_msg |
| 317 |
type: str |
| 318 |
|
| 319 |
playbook_on_vars_prompt_msg_color: |
| 320 |
description: |
| 321 |
- Output color to be used for O(playbook_on_vars_prompt_msg). |
| 322 |
- Template should render a L(valid color value,#notes). |
| 323 |
ini: |
| 324 |
- section: callback_diy |
| 325 |
key: playbook_on_vars_prompt_msg_color |
| 326 |
env: |
| 327 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_VARS_PROMPT_MSG_COLOR |
| 328 |
vars: |
| 329 |
- name: ansible_callback_diy_playbook_on_vars_prompt_msg_color |
| 330 |
type: str |
| 331 |
|
| 332 |
playbook_on_play_start_msg: |
| 333 |
description: Output to be used for callback playbook_on_play_start. |
| 334 |
ini: |
| 335 |
- section: callback_diy |
| 336 |
key: playbook_on_play_start_msg |
| 337 |
env: |
| 338 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_PLAY_START_MSG |
| 339 |
vars: |
| 340 |
- name: ansible_callback_diy_playbook_on_play_start_msg |
| 341 |
type: str |
| 342 |
|
| 343 |
playbook_on_play_start_msg_color: |
| 344 |
description: |
| 345 |
- Output color to be used for O(playbook_on_play_start_msg). |
| 346 |
- Template should render a L(valid color value,#notes). |
| 347 |
ini: |
| 348 |
- section: callback_diy |
| 349 |
key: playbook_on_play_start_msg_color |
| 350 |
env: |
| 351 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_PLAY_START_MSG_COLOR |
| 352 |
vars: |
| 353 |
- name: ansible_callback_diy_playbook_on_play_start_msg_color |
| 354 |
type: str |
| 355 |
|
| 356 |
playbook_on_stats_msg: |
| 357 |
description: Output to be used for callback playbook_on_stats. |
| 358 |
ini: |
| 359 |
- section: callback_diy |
| 360 |
key: playbook_on_stats_msg |
| 361 |
env: |
| 362 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_STATS_MSG |
| 363 |
vars: |
| 364 |
- name: ansible_callback_diy_playbook_on_stats_msg |
| 365 |
type: str |
| 366 |
|
| 367 |
playbook_on_stats_msg_color: |
| 368 |
description: |
| 369 |
- Output color to be used for O(playbook_on_stats_msg). |
| 370 |
- Template should render a L(valid color value,#notes). |
| 371 |
ini: |
| 372 |
- section: callback_diy |
| 373 |
key: playbook_on_stats_msg_color |
| 374 |
env: |
| 375 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_STATS_MSG_COLOR |
| 376 |
vars: |
| 377 |
- name: ansible_callback_diy_playbook_on_stats_msg_color |
| 378 |
type: str |
| 379 |
|
| 380 |
on_file_diff_msg: |
| 381 |
description: Output to be used for callback on_file_diff. |
| 382 |
ini: |
| 383 |
- section: callback_diy |
| 384 |
key: on_file_diff_msg |
| 385 |
env: |
| 386 |
- name: ANSIBLE_CALLBACK_DIY_ON_FILE_DIFF_MSG |
| 387 |
vars: |
| 388 |
- name: ansible_callback_diy_on_file_diff_msg |
| 389 |
type: str |
| 390 |
|
| 391 |
on_file_diff_msg_color: |
| 392 |
description: |
| 393 |
- Output color to be used for O(on_file_diff_msg). |
| 394 |
- Template should render a L(valid color value,#notes). |
| 395 |
ini: |
| 396 |
- section: callback_diy |
| 397 |
key: on_file_diff_msg_color |
| 398 |
env: |
| 399 |
- name: ANSIBLE_CALLBACK_DIY_ON_FILE_DIFF_MSG_COLOR |
| 400 |
vars: |
| 401 |
- name: ansible_callback_diy_on_file_diff_msg_color |
| 402 |
type: str |
| 403 |
|
| 404 |
playbook_on_include_msg: |
| 405 |
description: Output to be used for callback playbook_on_include. |
| 406 |
ini: |
| 407 |
- section: callback_diy |
| 408 |
key: playbook_on_include_msg |
| 409 |
env: |
| 410 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_INCLUDE_MSG |
| 411 |
vars: |
| 412 |
- name: ansible_callback_diy_playbook_on_include_msg |
| 413 |
type: str |
| 414 |
|
| 415 |
playbook_on_include_msg_color: |
| 416 |
description: |
| 417 |
- Output color to be used for O(playbook_on_include_msg). |
| 418 |
- Template should render a L(valid color value,#notes). |
| 419 |
ini: |
| 420 |
- section: callback_diy |
| 421 |
key: playbook_on_include_msg_color |
| 422 |
env: |
| 423 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_INCLUDE_MSG_COLOR |
| 424 |
vars: |
| 425 |
- name: ansible_callback_diy_playbook_on_include_msg_color |
| 426 |
type: str |
| 427 |
|
| 428 |
runner_item_on_ok_msg: |
| 429 |
description: Output to be used for callback runner_item_on_ok. |
| 430 |
ini: |
| 431 |
- section: callback_diy |
| 432 |
key: runner_item_on_ok_msg |
| 433 |
env: |
| 434 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_OK_MSG |
| 435 |
vars: |
| 436 |
- name: ansible_callback_diy_runner_item_on_ok_msg |
| 437 |
type: str |
| 438 |
|
| 439 |
runner_item_on_ok_msg_color: |
| 440 |
description: |
| 441 |
- Output color to be used for O(runner_item_on_ok_msg). |
| 442 |
- Template should render a L(valid color value,#notes). |
| 443 |
ini: |
| 444 |
- section: callback_diy |
| 445 |
key: runner_item_on_ok_msg_color |
| 446 |
env: |
| 447 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_OK_MSG_COLOR |
| 448 |
vars: |
| 449 |
- name: ansible_callback_diy_runner_item_on_ok_msg_color |
| 450 |
type: str |
| 451 |
|
| 452 |
runner_item_on_failed_msg: |
| 453 |
description: Output to be used for callback runner_item_on_failed. |
| 454 |
ini: |
| 455 |
- section: callback_diy |
| 456 |
key: runner_item_on_failed_msg |
| 457 |
env: |
| 458 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_FAILED_MSG |
| 459 |
vars: |
| 460 |
- name: ansible_callback_diy_runner_item_on_failed_msg |
| 461 |
type: str |
| 462 |
|
| 463 |
runner_item_on_failed_msg_color: |
| 464 |
description: |
| 465 |
- Output color to be used for O(runner_item_on_failed_msg). |
| 466 |
- Template should render a L(valid color value,#notes). |
| 467 |
ini: |
| 468 |
- section: callback_diy |
| 469 |
key: runner_item_on_failed_msg_color |
| 470 |
env: |
| 471 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_FAILED_MSG_COLOR |
| 472 |
vars: |
| 473 |
- name: ansible_callback_diy_runner_item_on_failed_msg_color |
| 474 |
type: str |
| 475 |
|
| 476 |
runner_item_on_skipped_msg: |
| 477 |
description: Output to be used for callback runner_item_on_skipped. |
| 478 |
ini: |
| 479 |
- section: callback_diy |
| 480 |
key: runner_item_on_skipped_msg |
| 481 |
env: |
| 482 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_SKIPPED_MSG |
| 483 |
vars: |
| 484 |
- name: ansible_callback_diy_runner_item_on_skipped_msg |
| 485 |
type: str |
| 486 |
|
| 487 |
runner_item_on_skipped_msg_color: |
| 488 |
description: |
| 489 |
- Output color to be used for O(runner_item_on_skipped_msg). |
| 490 |
- Template should render a L(valid color value,#notes). |
| 491 |
ini: |
| 492 |
- section: callback_diy |
| 493 |
key: runner_item_on_skipped_msg_color |
| 494 |
env: |
| 495 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_SKIPPED_MSG_COLOR |
| 496 |
vars: |
| 497 |
- name: ansible_callback_diy_runner_item_on_skipped_msg_color |
| 498 |
type: str |
| 499 |
|
| 500 |
runner_retry_msg: |
| 501 |
description: Output to be used for callback runner_retry. |
| 502 |
ini: |
| 503 |
- section: callback_diy |
| 504 |
key: runner_retry_msg |
| 505 |
env: |
| 506 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_RETRY_MSG |
| 507 |
vars: |
| 508 |
- name: ansible_callback_diy_runner_retry_msg |
| 509 |
type: str |
| 510 |
|
| 511 |
runner_retry_msg_color: |
| 512 |
description: |
| 513 |
- Output color to be used for O(runner_retry_msg). |
| 514 |
- Template should render a L(valid color value,#notes). |
| 515 |
ini: |
| 516 |
- section: callback_diy |
| 517 |
key: runner_retry_msg_color |
| 518 |
env: |
| 519 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_RETRY_MSG_COLOR |
| 520 |
vars: |
| 521 |
- name: ansible_callback_diy_runner_retry_msg_color |
| 522 |
type: str |
| 523 |
|
| 524 |
runner_on_start_msg: |
| 525 |
description: Output to be used for callback runner_on_start. |
| 526 |
ini: |
| 527 |
- section: callback_diy |
| 528 |
key: runner_on_start_msg |
| 529 |
env: |
| 530 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_START_MSG |
| 531 |
vars: |
| 532 |
- name: ansible_callback_diy_runner_on_start_msg |
| 533 |
type: str |
| 534 |
|
| 535 |
runner_on_start_msg_color: |
| 536 |
description: |
| 537 |
- Output color to be used for O(runner_on_start_msg). |
| 538 |
- Template should render a L(valid color value,#notes). |
| 539 |
ini: |
| 540 |
- section: callback_diy |
| 541 |
key: runner_on_start_msg_color |
| 542 |
env: |
| 543 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_START_MSG_COLOR |
| 544 |
vars: |
| 545 |
- name: ansible_callback_diy_runner_on_start_msg_color |
| 546 |
type: str |
| 547 |
|
| 548 |
runner_on_no_hosts_msg: |
| 549 |
description: Output to be used for callback runner_on_no_hosts. |
| 550 |
ini: |
| 551 |
- section: callback_diy |
| 552 |
key: runner_on_no_hosts_msg |
| 553 |
env: |
| 554 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_NO_HOSTS_MSG |
| 555 |
vars: |
| 556 |
- name: ansible_callback_diy_runner_on_no_hosts_msg |
| 557 |
type: str |
| 558 |
|
| 559 |
runner_on_no_hosts_msg_color: |
| 560 |
description: |
| 561 |
- Output color to be used for O(runner_on_no_hosts_msg). |
| 562 |
- Template should render a L(valid color value,#notes). |
| 563 |
ini: |
| 564 |
- section: callback_diy |
| 565 |
key: runner_on_no_hosts_msg_color |
| 566 |
env: |
| 567 |
- name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_NO_HOSTS_MSG_COLOR |
| 568 |
vars: |
| 569 |
- name: ansible_callback_diy_runner_on_no_hosts_msg_color |
| 570 |
type: str |
| 571 |
|
| 572 |
playbook_on_setup_msg: |
| 573 |
description: Output to be used for callback playbook_on_setup. |
| 574 |
ini: |
| 575 |
- section: callback_diy |
| 576 |
key: playbook_on_setup_msg |
| 577 |
env: |
| 578 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_SETUP_MSG |
| 579 |
vars: |
| 580 |
- name: ansible_callback_diy_playbook_on_setup_msg |
| 581 |
type: str |
| 582 |
|
| 583 |
playbook_on_setup_msg_color: |
| 584 |
description: |
| 585 |
- Output color to be used for O(playbook_on_setup_msg). |
| 586 |
- Template should render a L(valid color value,#notes). |
| 587 |
ini: |
| 588 |
- section: callback_diy |
| 589 |
key: playbook_on_setup_msg_color |
| 590 |
env: |
| 591 |
- name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_SETUP_MSG_COLOR |
| 592 |
vars: |
| 593 |
- name: ansible_callback_diy_playbook_on_setup_msg_color |
| 594 |
type: str |
| 595 |
""" |
| 596 |
|
| 597 |
EXAMPLES = r""" |
| 598 |
ansible.cfg: > |
| 599 |
# Enable plugin |
| 600 |
[defaults] |
| 601 |
stdout_callback=community.general.diy |
| 602 |
|
| 603 |
[callback_diy] |
| 604 |
# Output when playbook starts |
| 605 |
playbook_on_start_msg="DIY output(via ansible.cfg): playbook example: {{ ansible_callback_diy.playbook.file_name }}" |
| 606 |
playbook_on_start_msg_color=yellow |
| 607 |
|
| 608 |
# Comment out to allow default plugin output |
| 609 |
# playbook_on_play_start_msg="PLAY: starting play {{ ansible_callback_diy.play.name }}" |
| 610 |
|
| 611 |
# Accept on_skipped_msg or ansible_callback_diy_runner_on_skipped_msg as input vars |
| 612 |
# If neither are supplied, omit the option |
| 613 |
runner_on_skipped_msg="{{ on_skipped_msg | default(ansible_callback_diy_runner_on_skipped_msg) | default(omit) }}" |
| 614 |
|
| 615 |
# Newline after every callback |
| 616 |
# on_any_msg='{{ " " | join("\n") }}' |
| 617 |
|
| 618 |
playbook.yml: >- |
| 619 |
--- |
| 620 |
- name: "Default plugin output: play example" |
| 621 |
hosts: localhost |
| 622 |
gather_facts: false |
| 623 |
tasks: |
| 624 |
- name: Default plugin output |
| 625 |
ansible.builtin.debug: |
| 626 |
msg: default plugin output |
| 627 |
|
| 628 |
- name: Override from play vars |
| 629 |
hosts: localhost |
| 630 |
gather_facts: false |
| 631 |
vars: |
| 632 |
ansible_connection: local |
| 633 |
green: "\e[0m\e[38;5;82m" |
| 634 |
yellow: "\e[0m\e[38;5;11m" |
| 635 |
bright_purple: "\e[0m\e[38;5;105m" |
| 636 |
cyan: "\e[0m\e[38;5;51m" |
| 637 |
green_bg_black_fg: "\e[0m\e[48;5;40m\e[38;5;232m" |
| 638 |
yellow_bg_black_fg: "\e[0m\e[48;5;226m\e[38;5;232m" |
| 639 |
purple_bg_white_fg: "\e[0m\e[48;5;57m\e[38;5;255m" |
| 640 |
cyan_bg_black_fg: "\e[0m\e[48;5;87m\e[38;5;232m" |
| 641 |
magenta: "\e[38;5;198m" |
| 642 |
white: "\e[0m\e[38;5;255m" |
| 643 |
ansible_callback_diy_playbook_on_play_start_msg: "\n{{green}}DIY output(via play vars): play example: {{magenta}}{{ansible_callback_diy.play.name}}\n\n" |
| 644 |
ansible_callback_diy_playbook_on_task_start_msg: "DIY output(via play vars): task example: {{ ansible_callback_diy.task.name }}" |
| 645 |
ansible_callback_diy_playbook_on_task_start_msg_color: cyan |
| 646 |
ansible_callback_diy_playbook_on_stats_msg: |+2 |
| 647 |
CUSTOM STATS |
| 648 |
============================== |
| 649 |
{% for key in ansible_callback_diy.stats | sort %} |
| 650 |
{% if ansible_callback_diy.stats[key] %} |
| 651 |
{% if key == 'ok' %} |
| 652 |
{% set color_one = lookup('vars','green_bg_black_fg') %} |
| 653 |
{% set prefix = ' ' %} |
| 654 |
{% set suffix = ' ' %} |
| 655 |
{% set color_two = lookup('vars','green') %} |
| 656 |
{% elif key == 'changed' %} |
| 657 |
{% set color_one = lookup('vars','yellow_bg_black_fg') %} |
| 658 |
{% set prefix = ' ' %} |
| 659 |
{% set suffix = ' ' %} |
| 660 |
{% set color_two = lookup('vars','yellow') %} |
| 661 |
{% elif key == 'processed' %} |
| 662 |
{% set color_one = lookup('vars','purple_bg_white_fg') %} |
| 663 |
{% set prefix = ' ' %} |
| 664 |
{% set suffix = ' ' %} |
| 665 |
{% set color_two = lookup('vars','bright_purple') %} |
| 666 |
{% elif key == 'skipped' %} |
| 667 |
{% set color_one = lookup('vars','cyan_bg_black_fg') %} |
| 668 |
{% set prefix = ' ' %} |
| 669 |
{% set suffix = ' ' %} |
| 670 |
{% set color_two = lookup('vars','cyan') %} |
| 671 |
{% else %} |
| 672 |
{% set color_one = "" %} |
| 673 |
{% set prefix = "" %} |
| 674 |
{% set suffix = "" %} |
| 675 |
{% set color_two = "" %} |
| 676 |
{% endif %} |
| 677 |
{{ color_one }}{{ "%s%s%s" | format(prefix,key,suffix) }}{{ color_two }}: {{ ansible_callback_diy.stats[key] | to_nice_yaml }} |
| 678 |
{% endif %} |
| 679 |
{% endfor %} |
| 680 |
|
| 681 |
tasks: |
| 682 |
- name: Custom banner with default plugin result output |
| 683 |
ansible.builtin.debug: |
| 684 |
msg: "default plugin output: result example" |
| 685 |
|
| 686 |
- name: Override from task vars |
| 687 |
ansible.builtin.debug: |
| 688 |
msg: "example {{ two }}" |
| 689 |
changed_when: true |
| 690 |
vars: |
| 691 |
white_fg_red_bg: "\e[0m\e[48;5;1m" |
| 692 |
two: "{{ white_fg_red_bg }} 2 " |
| 693 |
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}" |
| 694 |
ansible_callback_diy_playbook_on_task_start_msg_color: bright magenta |
| 695 |
ansible_callback_diy_runner_on_ok_msg: "DIY output(via task vars): result example: \n{{ ansible_callback_diy.result.output.msg }}\n" |
| 696 |
ansible_callback_diy_runner_on_ok_msg_color: "{{ 'yellow' if ansible_callback_diy.result.is_changed else 'bright green' }}" |
| 697 |
|
| 698 |
- name: Suppress output |
| 699 |
ansible.builtin.debug: |
| 700 |
msg: i should not be displayed |
| 701 |
vars: |
| 702 |
ansible_callback_diy_playbook_on_task_start_msg: "" |
| 703 |
ansible_callback_diy_runner_on_ok_msg: "" |
| 704 |
|
| 705 |
- name: Using alias vars (see ansible.cfg) |
| 706 |
ansible.builtin.debug: |
| 707 |
msg: |
| 708 |
when: false |
| 709 |
vars: |
| 710 |
ansible_callback_diy_playbook_on_task_start_msg: "" |
| 711 |
on_skipped_msg: "DIY output(via task vars): skipped example:\n\e[0m\e[38;5;4m\u25b6\u25b6 {{ ansible_callback_diy.result.task.name }}\n" |
| 712 |
on_skipped_msg_color: white |
| 713 |
|
| 714 |
- name: Just stdout |
| 715 |
ansible.builtin.command: echo some stdout |
| 716 |
vars: |
| 717 |
ansible_callback_diy_playbook_on_task_start_msg: "\n" |
| 718 |
ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.stdout }}\n" |
| 719 |
|
| 720 |
- name: Multiline output |
| 721 |
ansible.builtin.debug: |
| 722 |
msg: "{{ multiline }}" |
| 723 |
vars: |
| 724 |
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}" |
| 725 |
multiline: "line\nline\nline" |
| 726 |
ansible_callback_diy_runner_on_ok_msg: |+2 |
| 727 |
some |
| 728 |
{{ ansible_callback_diy.result.output.msg }} |
| 729 |
output |
| 730 |
|
| 731 |
ansible_callback_diy_playbook_on_task_start_msg_color: bright blue |
| 732 |
|
| 733 |
- name: Indentation |
| 734 |
ansible.builtin.debug: |
| 735 |
msg: "{{ item.msg }}" |
| 736 |
with_items: |
| 737 |
- { indent: 1, msg: one., color: red } |
| 738 |
- { indent: 2, msg: two.., color: yellow } |
| 739 |
- { indent: 3, msg: three..., color: bright yellow } |
| 740 |
vars: |
| 741 |
ansible_callback_diy_runner_item_on_ok_msg: "{{ ansible_callback_diy.result.output.msg | indent(item.indent, True) }}" |
| 742 |
ansible_callback_diy_runner_item_on_ok_msg_color: "{{ item.color }}" |
| 743 |
ansible_callback_diy_runner_on_ok_msg: "GO!!!" |
| 744 |
ansible_callback_diy_runner_on_ok_msg_color: bright green |
| 745 |
|
| 746 |
- name: Using lookup and template as file |
| 747 |
ansible.builtin.shell: "echo {% raw %}'output from {{ file_name }}'{% endraw %} > {{ file_name }}" |
| 748 |
vars: |
| 749 |
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}" |
| 750 |
file_name: diy_file_template_example |
| 751 |
ansible_callback_diy_runner_on_ok_msg: "{{ lookup('template', file_name) }}" |
| 752 |
|
| 753 |
- name: 'Look at top level vars available to the "runner_on_ok" callback' |
| 754 |
ansible.builtin.debug: |
| 755 |
msg: '' |
| 756 |
vars: |
| 757 |
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}" |
| 758 |
ansible_callback_diy_runner_on_ok_msg: |+2 |
| 759 |
{% for var in (ansible_callback_diy.top_level_var_names|reject('match','vars|ansible_callback_diy.*')) | sort %} |
| 760 |
{{ green }}{{ var }}: |
| 761 |
{{ white }}{{ lookup('vars', var) }} |
| 762 |
|
| 763 |
{% endfor %} |
| 764 |
ansible_callback_diy_runner_on_ok_msg_color: white |
| 765 |
|
| 766 |
- name: 'Look at event data available to the "runner_on_ok" callback' |
| 767 |
ansible.builtin.debug: |
| 768 |
msg: '' |
| 769 |
vars: |
| 770 |
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}" |
| 771 |
ansible_callback_diy_runner_on_ok_msg: |+2 |
| 772 |
{% for key in ansible_callback_diy | sort %} |
| 773 |
{{ green }}{{ key }}: |
| 774 |
{{ white }}{{ ansible_callback_diy[key] }} |
| 775 |
|
| 776 |
{% endfor %} |
| 777 |
""" |
| 778 |
|
| 779 |
import sys |
| 780 |
from contextlib import contextmanager |
| 781 |
|
| 782 |
from ansible.module_utils.common.text.converters import to_text |
| 783 |
from ansible.plugins.callback.default import CallbackModule as Default |
| 784 |
from ansible.template import Templar |
| 785 |
from ansible.vars.manager import VariableManager |
| 786 |
|
| 787 |
try: |
| 788 |
from ansible.template import trust_as_template # noqa: F401, pylint: disable=unused-import |
| 789 |
|
| 790 |
SUPPORTS_DATA_TAGGING = True |
| 791 |
except ImportError: |
| 792 |
SUPPORTS_DATA_TAGGING = False |
| 793 |
|
| 794 |
|
| 795 |
class DummyStdout: |
| 796 |
def flush(self): |
| 797 |
pass |
| 798 |
|
| 799 |
def write(self, b): |
| 800 |
pass |
| 801 |
|
| 802 |
def writelines(self, l): |
| 803 |
pass |
| 804 |
|
| 805 |
|
| 806 |
class CallbackModule(Default): |
| 807 |
""" |
| 808 |
Callback plugin that allows you to supply your own custom callback templates to be output. |
| 809 |
""" |
| 810 |
|
| 811 |
CALLBACK_VERSION = 2.0 |
| 812 |
CALLBACK_TYPE = "stdout" |
| 813 |
CALLBACK_NAME = "community.general.diy" |
| 814 |
|
| 815 |
DIY_NS = "ansible_callback_diy" |
| 816 |
|
| 817 |
@contextmanager |
| 818 |
def _suppress_stdout(self, enabled): |
| 819 |
saved_stdout = sys.stdout |
| 820 |
if enabled: |
| 821 |
sys.stdout = DummyStdout() |
| 822 |
yield |
| 823 |
sys.stdout = saved_stdout |
| 824 |
|
| 825 |
def _get_output_specification(self, loader, variables): |
| 826 |
_ret = {} |
| 827 |
_calling_method = sys._getframe(1).f_code.co_name |
| 828 |
_callback_type = _calling_method[3:] if _calling_method[:3] == "v2_" else _calling_method |
| 829 |
_callback_options = ["msg", "msg_color"] |
| 830 |
|
| 831 |
for option in _callback_options: |
| 832 |
_option_name = f"{_callback_type}_{option}" |
| 833 |
_option_template = variables.get(f"{self.DIY_NS}_{_option_name}", self.get_option(_option_name)) |
| 834 |
_ret.update({option: self._template(loader=loader, template=_option_template, variables=variables)}) |
| 835 |
|
| 836 |
_ret.update({"vars": variables}) |
| 837 |
|
| 838 |
return _ret |
| 839 |
|
| 840 |
def _using_diy(self, spec): |
| 841 |
sentinel = object() |
| 842 |
omit = spec["vars"].get("omit", sentinel) |
| 843 |
# With Data Tagging, omit is sentinel |
| 844 |
return (spec["msg"] is not None) and (spec["msg"] != omit or omit is sentinel) |
| 845 |
|
| 846 |
def _parent_has_callback(self): |
| 847 |
return hasattr(super(), sys._getframe(1).f_code.co_name) |
| 848 |
|
| 849 |
def _template(self, loader, template, variables): |
| 850 |
_templar = Templar(loader=loader, variables=variables) |
| 851 |
return _templar.template(template, preserve_trailing_newlines=True, convert_data=False, escape_backslashes=True) |
| 852 |
|
| 853 |
def _output(self, spec, stderr=False): |
| 854 |
_msg = to_text(spec["msg"]) |
| 855 |
if len(_msg) > 0: |
| 856 |
self._display.display(msg=_msg, color=spec["msg_color"], stderr=stderr) |
| 857 |
|
| 858 |
def _get_vars( |
| 859 |
self, |
| 860 |
playbook, |
| 861 |
play=None, |
| 862 |
host=None, |
| 863 |
task=None, |
| 864 |
included_file=None, |
| 865 |
handler=None, |
| 866 |
result=None, |
| 867 |
stats=None, |
| 868 |
remove_attr_ref_loop=True, |
| 869 |
): |
| 870 |
def _get_value(obj, attr=None, method=None): |
| 871 |
if attr: |
| 872 |
return getattr(obj, attr, getattr(obj, f"_{attr}", None)) |
| 873 |
|
| 874 |
if method: |
| 875 |
_method = getattr(obj, method) |
| 876 |
return _method() |
| 877 |
|
| 878 |
def _remove_attr_ref_loop(obj, attributes): |
| 879 |
_loop_var = getattr(obj, "loop_control", None) |
| 880 |
_loop_var = _loop_var or "item" |
| 881 |
|
| 882 |
for attr in attributes: |
| 883 |
if str(_loop_var) in str(_get_value(obj=obj, attr=attr)): |
| 884 |
attributes.remove(attr) |
| 885 |
|
| 886 |
return attributes |
| 887 |
|
| 888 |
class CallbackDIYDict(dict): |
| 889 |
def __deepcopy__(self, memo): |
| 890 |
return self |
| 891 |
|
| 892 |
_ret = {} |
| 893 |
|
| 894 |
_variable_manager = VariableManager(loader=playbook.get_loader()) |
| 895 |
|
| 896 |
_all = _variable_manager.get_vars() |
| 897 |
if play: |
| 898 |
_all = play.get_variable_manager().get_vars( |
| 899 |
play=play, host=(host if host else getattr(result, "_host", None)), task=(handler if handler else task) |
| 900 |
) |
| 901 |
_ret.update(_all) |
| 902 |
|
| 903 |
_ret.update(_ret.get(self.DIY_NS, {self.DIY_NS: {} if SUPPORTS_DATA_TAGGING else CallbackDIYDict()})) |
| 904 |
|
| 905 |
_ret[self.DIY_NS].update({"playbook": {}}) |
| 906 |
_playbook_attributes = ["entries", "file_name", "basedir"] |
| 907 |
|
| 908 |
for attr in _playbook_attributes: |
| 909 |
_ret[self.DIY_NS]["playbook"].update({attr: _get_value(obj=playbook, attr=attr)}) |
| 910 |
|
| 911 |
if play: |
| 912 |
_ret[self.DIY_NS].update({"play": {}}) |
| 913 |
_play_attributes = [ |
| 914 |
"any_errors_fatal", |
| 915 |
"become", |
| 916 |
"become_flags", |
| 917 |
"become_method", |
| 918 |
"become_user", |
| 919 |
"check_mode", |
| 920 |
"collections", |
| 921 |
"connection", |
| 922 |
"debugger", |
| 923 |
"diff", |
| 924 |
"environment", |
| 925 |
"fact_path", |
| 926 |
"finalized", |
| 927 |
"force_handlers", |
| 928 |
"gather_facts", |
| 929 |
"gather_subset", |
| 930 |
"gather_timeout", |
| 931 |
"handlers", |
| 932 |
"hosts", |
| 933 |
"ignore_errors", |
| 934 |
"ignore_unreachable", |
| 935 |
"included_conditional", |
| 936 |
"included_path", |
| 937 |
"max_fail_percentage", |
| 938 |
"module_defaults", |
| 939 |
"name", |
| 940 |
"no_log", |
| 941 |
"only_tags", |
| 942 |
"order", |
| 943 |
"port", |
| 944 |
"post_tasks", |
| 945 |
"pre_tasks", |
| 946 |
"remote_user", |
| 947 |
"removed_hosts", |
| 948 |
"roles", |
| 949 |
"run_once", |
| 950 |
"serial", |
| 951 |
"skip_tags", |
| 952 |
"squashed", |
| 953 |
"strategy", |
| 954 |
"tags", |
| 955 |
"tasks", |
| 956 |
"uuid", |
| 957 |
"validated", |
| 958 |
"vars_files", |
| 959 |
"vars_prompt", |
| 960 |
] |
| 961 |
|
| 962 |
for attr in _play_attributes: |
| 963 |
_ret[self.DIY_NS]["play"].update({attr: _get_value(obj=play, attr=attr)}) |
| 964 |
|
| 965 |
if host: |
| 966 |
_ret[self.DIY_NS].update({"host": {}}) |
| 967 |
_host_attributes = ["name", "uuid", "address", "implicit"] |
| 968 |
|
| 969 |
for attr in _host_attributes: |
| 970 |
_ret[self.DIY_NS]["host"].update({attr: _get_value(obj=host, attr=attr)}) |
| 971 |
|
| 972 |
if task: |
| 973 |
_ret[self.DIY_NS].update({"task": {}}) |
| 974 |
_task_attributes = [ |
| 975 |
"action", |
| 976 |
"any_errors_fatal", |
| 977 |
"args", |
| 978 |
"async", |
| 979 |
"async_val", |
| 980 |
"become", |
| 981 |
"become_flags", |
| 982 |
"become_method", |
| 983 |
"become_user", |
| 984 |
"changed_when", |
| 985 |
"check_mode", |
| 986 |
"collections", |
| 987 |
"connection", |
| 988 |
"debugger", |
| 989 |
"delay", |
| 990 |
"delegate_facts", |
| 991 |
"delegate_to", |
| 992 |
"diff", |
| 993 |
"environment", |
| 994 |
"failed_when", |
| 995 |
"finalized", |
| 996 |
"ignore_errors", |
| 997 |
"ignore_unreachable", |
| 998 |
"loop", |
| 999 |
"loop_control", |
| 1000 |
"loop_with", |
| 1001 |
"module_defaults", |
| 1002 |
"name", |
| 1003 |
"no_log", |
| 1004 |
"notify", |
| 1005 |
"parent", |
| 1006 |
"poll", |
| 1007 |
"port", |
| 1008 |
"register", |
| 1009 |
"remote_user", |
| 1010 |
"retries", |
| 1011 |
"role", |
| 1012 |
"run_once", |
| 1013 |
"squashed", |
| 1014 |
"tags", |
| 1015 |
"untagged", |
| 1016 |
"until", |
| 1017 |
"uuid", |
| 1018 |
"validated", |
| 1019 |
"when", |
| 1020 |
] |
| 1021 |
|
| 1022 |
# remove arguments that reference a loop var because they cause templating issues in |
| 1023 |
# callbacks that do not have the loop context(e.g. playbook_on_task_start) |
| 1024 |
if task.loop and remove_attr_ref_loop: |
| 1025 |
_task_attributes = _remove_attr_ref_loop(obj=task, attributes=_task_attributes) |
| 1026 |
|
| 1027 |
for attr in _task_attributes: |
| 1028 |
_ret[self.DIY_NS]["task"].update({attr: _get_value(obj=task, attr=attr)}) |
| 1029 |
|
| 1030 |
if included_file: |
| 1031 |
_ret[self.DIY_NS].update({"included_file": {}}) |
| 1032 |
_included_file_attributes = ["args", "filename", "hosts", "is_role", "task"] |
| 1033 |
|
| 1034 |
for attr in _included_file_attributes: |
| 1035 |
_ret[self.DIY_NS]["included_file"].update({attr: _get_value(obj=included_file, attr=attr)}) |
| 1036 |
|
| 1037 |
if handler: |
| 1038 |
_ret[self.DIY_NS].update({"handler": {}}) |
| 1039 |
_handler_attributes = [ |
| 1040 |
"action", |
| 1041 |
"any_errors_fatal", |
| 1042 |
"args", |
| 1043 |
"async", |
| 1044 |
"async_val", |
| 1045 |
"become", |
| 1046 |
"become_flags", |
| 1047 |
"become_method", |
| 1048 |
"become_user", |
| 1049 |
"changed_when", |
| 1050 |
"check_mode", |
| 1051 |
"collections", |
| 1052 |
"connection", |
| 1053 |
"debugger", |
| 1054 |
"delay", |
| 1055 |
"delegate_facts", |
| 1056 |
"delegate_to", |
| 1057 |
"diff", |
| 1058 |
"environment", |
| 1059 |
"failed_when", |
| 1060 |
"finalized", |
| 1061 |
"ignore_errors", |
| 1062 |
"ignore_unreachable", |
| 1063 |
"listen", |
| 1064 |
"loop", |
| 1065 |
"loop_control", |
| 1066 |
"loop_with", |
| 1067 |
"module_defaults", |
| 1068 |
"name", |
| 1069 |
"no_log", |
| 1070 |
"notified_hosts", |
| 1071 |
"notify", |
| 1072 |
"parent", |
| 1073 |
"poll", |
| 1074 |
"port", |
| 1075 |
"register", |
| 1076 |
"remote_user", |
| 1077 |
"retries", |
| 1078 |
"role", |
| 1079 |
"run_once", |
| 1080 |
"squashed", |
| 1081 |
"tags", |
| 1082 |
"untagged", |
| 1083 |
"until", |
| 1084 |
"uuid", |
| 1085 |
"validated", |
| 1086 |
"when", |
| 1087 |
] |
| 1088 |
|
| 1089 |
if handler.loop and remove_attr_ref_loop: |
| 1090 |
_handler_attributes = _remove_attr_ref_loop(obj=handler, attributes=_handler_attributes) |
| 1091 |
|
| 1092 |
for attr in _handler_attributes: |
| 1093 |
_ret[self.DIY_NS]["handler"].update({attr: _get_value(obj=handler, attr=attr)}) |
| 1094 |
|
| 1095 |
_ret[self.DIY_NS]["handler"].update({"is_host_notified": handler.is_host_notified(host)}) |
| 1096 |
|
| 1097 |
if result: |
| 1098 |
_ret[self.DIY_NS].update({"result": {}}) |
| 1099 |
_result_attributes = ["host", "task", "task_name"] |
| 1100 |
|
| 1101 |
for attr in _result_attributes: |
| 1102 |
_ret[self.DIY_NS]["result"].update({attr: _get_value(obj=result, attr=attr)}) |
| 1103 |
|
| 1104 |
_result_methods = ["is_changed", "is_failed", "is_skipped", "is_unreachable"] |
| 1105 |
|
| 1106 |
for method in _result_methods: |
| 1107 |
_ret[self.DIY_NS]["result"].update({method: _get_value(obj=result, method=method)}) |
| 1108 |
|
| 1109 |
_ret[self.DIY_NS]["result"].update({"output": getattr(result, "_result", None)}) |
| 1110 |
|
| 1111 |
_ret.update(result._result) |
| 1112 |
|
| 1113 |
if stats: |
| 1114 |
_ret[self.DIY_NS].update({"stats": {}}) |
| 1115 |
_stats_attributes = [ |
| 1116 |
"changed", |
| 1117 |
"custom", |
| 1118 |
"dark", |
| 1119 |
"failures", |
| 1120 |
"ignored", |
| 1121 |
"ok", |
| 1122 |
"processed", |
| 1123 |
"rescued", |
| 1124 |
"skipped", |
| 1125 |
] |
| 1126 |
|
| 1127 |
for attr in _stats_attributes: |
| 1128 |
_ret[self.DIY_NS]["stats"].update({attr: _get_value(obj=stats, attr=attr)}) |
| 1129 |
|
| 1130 |
_ret[self.DIY_NS].update({"top_level_var_names": list(_ret.keys())}) |
| 1131 |
|
| 1132 |
return _ret |
| 1133 |
|
| 1134 |
def v2_on_any(self, *args, **kwargs): |
| 1135 |
self._diy_spec = self._get_output_specification(loader=self._diy_loader, variables=self._diy_spec["vars"]) |
| 1136 |
|
| 1137 |
if self._using_diy(spec=self._diy_spec): |
| 1138 |
self._output(spec=self._diy_spec) |
| 1139 |
|
| 1140 |
if self._parent_has_callback(): |
| 1141 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1142 |
super().v2_on_any(*args, **kwargs) |
| 1143 |
|
| 1144 |
def v2_runner_on_failed(self, result, ignore_errors=False): |
| 1145 |
self._diy_spec = self._get_output_specification( |
| 1146 |
loader=self._diy_loader, |
| 1147 |
variables=self._get_vars( |
| 1148 |
playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task, result=result |
| 1149 |
), |
| 1150 |
) |
| 1151 |
|
| 1152 |
if self._using_diy(spec=self._diy_spec): |
| 1153 |
self._output(spec=self._diy_spec, stderr=(not ignore_errors)) |
| 1154 |
|
| 1155 |
if self._parent_has_callback(): |
| 1156 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1157 |
super().v2_runner_on_failed(result, ignore_errors) |
| 1158 |
|
| 1159 |
def v2_runner_on_ok(self, result): |
| 1160 |
self._diy_spec = self._get_output_specification( |
| 1161 |
loader=self._diy_loader, |
| 1162 |
variables=self._get_vars( |
| 1163 |
playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task, result=result |
| 1164 |
), |
| 1165 |
) |
| 1166 |
|
| 1167 |
if self._using_diy(spec=self._diy_spec): |
| 1168 |
self._output(spec=self._diy_spec) |
| 1169 |
|
| 1170 |
if self._parent_has_callback(): |
| 1171 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1172 |
super().v2_runner_on_ok(result) |
| 1173 |
|
| 1174 |
def v2_runner_on_skipped(self, result): |
| 1175 |
self._diy_spec = self._get_output_specification( |
| 1176 |
loader=self._diy_loader, |
| 1177 |
variables=self._get_vars( |
| 1178 |
playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task, result=result |
| 1179 |
), |
| 1180 |
) |
| 1181 |
|
| 1182 |
if self._using_diy(spec=self._diy_spec): |
| 1183 |
self._output(spec=self._diy_spec) |
| 1184 |
|
| 1185 |
if self._parent_has_callback(): |
| 1186 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1187 |
super().v2_runner_on_skipped(result) |
| 1188 |
|
| 1189 |
def v2_runner_on_unreachable(self, result): |
| 1190 |
self._diy_spec = self._get_output_specification( |
| 1191 |
loader=self._diy_loader, |
| 1192 |
variables=self._get_vars( |
| 1193 |
playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task, result=result |
| 1194 |
), |
| 1195 |
) |
| 1196 |
|
| 1197 |
if self._using_diy(spec=self._diy_spec): |
| 1198 |
self._output(spec=self._diy_spec) |
| 1199 |
|
| 1200 |
if self._parent_has_callback(): |
| 1201 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1202 |
super().v2_runner_on_unreachable(result) |
| 1203 |
|
| 1204 |
# not implemented as the call to this is not implemented yet |
| 1205 |
def v2_runner_on_async_poll(self, result): |
| 1206 |
pass |
| 1207 |
|
| 1208 |
# not implemented as the call to this is not implemented yet |
| 1209 |
def v2_runner_on_async_ok(self, result): |
| 1210 |
pass |
| 1211 |
|
| 1212 |
# not implemented as the call to this is not implemented yet |
| 1213 |
def v2_runner_on_async_failed(self, result): |
| 1214 |
pass |
| 1215 |
|
| 1216 |
def v2_runner_item_on_ok(self, result): |
| 1217 |
self._diy_spec = self._get_output_specification( |
| 1218 |
loader=self._diy_loader, |
| 1219 |
variables=self._get_vars( |
| 1220 |
playbook=self._diy_playbook, |
| 1221 |
play=self._diy_play, |
| 1222 |
task=self._diy_task, |
| 1223 |
result=result, |
| 1224 |
remove_attr_ref_loop=False, |
| 1225 |
), |
| 1226 |
) |
| 1227 |
|
| 1228 |
if self._using_diy(spec=self._diy_spec): |
| 1229 |
self._output(spec=self._diy_spec) |
| 1230 |
|
| 1231 |
if self._parent_has_callback(): |
| 1232 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1233 |
super().v2_runner_item_on_ok(result) |
| 1234 |
|
| 1235 |
def v2_runner_item_on_failed(self, result): |
| 1236 |
self._diy_spec = self._get_output_specification( |
| 1237 |
loader=self._diy_loader, |
| 1238 |
variables=self._get_vars( |
| 1239 |
playbook=self._diy_playbook, |
| 1240 |
play=self._diy_play, |
| 1241 |
task=self._diy_task, |
| 1242 |
result=result, |
| 1243 |
remove_attr_ref_loop=False, |
| 1244 |
), |
| 1245 |
) |
| 1246 |
|
| 1247 |
if self._using_diy(spec=self._diy_spec): |
| 1248 |
self._output(spec=self._diy_spec) |
| 1249 |
|
| 1250 |
if self._parent_has_callback(): |
| 1251 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1252 |
super().v2_runner_item_on_failed(result) |
| 1253 |
|
| 1254 |
def v2_runner_item_on_skipped(self, result): |
| 1255 |
self._diy_spec = self._get_output_specification( |
| 1256 |
loader=self._diy_loader, |
| 1257 |
variables=self._get_vars( |
| 1258 |
playbook=self._diy_playbook, |
| 1259 |
play=self._diy_play, |
| 1260 |
task=self._diy_task, |
| 1261 |
result=result, |
| 1262 |
remove_attr_ref_loop=False, |
| 1263 |
), |
| 1264 |
) |
| 1265 |
|
| 1266 |
if self._using_diy(spec=self._diy_spec): |
| 1267 |
self._output(spec=self._diy_spec) |
| 1268 |
|
| 1269 |
if self._parent_has_callback(): |
| 1270 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1271 |
super().v2_runner_item_on_skipped(result) |
| 1272 |
|
| 1273 |
def v2_runner_retry(self, result): |
| 1274 |
self._diy_spec = self._get_output_specification( |
| 1275 |
loader=self._diy_loader, |
| 1276 |
variables=self._get_vars( |
| 1277 |
playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task, result=result |
| 1278 |
), |
| 1279 |
) |
| 1280 |
|
| 1281 |
if self._using_diy(spec=self._diy_spec): |
| 1282 |
self._output(spec=self._diy_spec) |
| 1283 |
|
| 1284 |
if self._parent_has_callback(): |
| 1285 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1286 |
super().v2_runner_retry(result) |
| 1287 |
|
| 1288 |
def v2_runner_on_start(self, host, task): |
| 1289 |
self._diy_host = host |
| 1290 |
self._diy_task = task |
| 1291 |
|
| 1292 |
self._diy_spec = self._get_output_specification( |
| 1293 |
loader=self._diy_loader, |
| 1294 |
variables=self._get_vars( |
| 1295 |
playbook=self._diy_playbook, play=self._diy_play, host=self._diy_host, task=self._diy_task |
| 1296 |
), |
| 1297 |
) |
| 1298 |
|
| 1299 |
if self._using_diy(spec=self._diy_spec): |
| 1300 |
self._output(spec=self._diy_spec) |
| 1301 |
|
| 1302 |
if self._parent_has_callback(): |
| 1303 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1304 |
super().v2_runner_on_start(host, task) |
| 1305 |
|
| 1306 |
def v2_playbook_on_start(self, playbook): |
| 1307 |
self._diy_playbook = playbook |
| 1308 |
self._diy_loader = self._diy_playbook.get_loader() |
| 1309 |
|
| 1310 |
self._diy_spec = self._get_output_specification( |
| 1311 |
loader=self._diy_loader, variables=self._get_vars(playbook=self._diy_playbook) |
| 1312 |
) |
| 1313 |
|
| 1314 |
if self._using_diy(spec=self._diy_spec): |
| 1315 |
self._output(spec=self._diy_spec) |
| 1316 |
|
| 1317 |
if self._parent_has_callback(): |
| 1318 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1319 |
super().v2_playbook_on_start(playbook) |
| 1320 |
|
| 1321 |
def v2_playbook_on_notify(self, handler, host): |
| 1322 |
self._diy_handler = handler |
| 1323 |
self._diy_host = host |
| 1324 |
|
| 1325 |
self._diy_spec = self._get_output_specification( |
| 1326 |
loader=self._diy_loader, |
| 1327 |
variables=self._get_vars( |
| 1328 |
playbook=self._diy_playbook, play=self._diy_play, host=self._diy_host, handler=self._diy_handler |
| 1329 |
), |
| 1330 |
) |
| 1331 |
|
| 1332 |
if self._using_diy(spec=self._diy_spec): |
| 1333 |
self._output(spec=self._diy_spec) |
| 1334 |
|
| 1335 |
if self._parent_has_callback(): |
| 1336 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1337 |
super().v2_playbook_on_notify(handler, host) |
| 1338 |
|
| 1339 |
def v2_playbook_on_no_hosts_matched(self): |
| 1340 |
self._diy_spec = self._get_output_specification(loader=self._diy_loader, variables=self._diy_spec["vars"]) |
| 1341 |
|
| 1342 |
if self._using_diy(spec=self._diy_spec): |
| 1343 |
self._output(spec=self._diy_spec) |
| 1344 |
|
| 1345 |
if self._parent_has_callback(): |
| 1346 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1347 |
super().v2_playbook_on_no_hosts_matched() |
| 1348 |
|
| 1349 |
def v2_playbook_on_no_hosts_remaining(self): |
| 1350 |
self._diy_spec = self._get_output_specification(loader=self._diy_loader, variables=self._diy_spec["vars"]) |
| 1351 |
|
| 1352 |
if self._using_diy(spec=self._diy_spec): |
| 1353 |
self._output(spec=self._diy_spec) |
| 1354 |
|
| 1355 |
if self._parent_has_callback(): |
| 1356 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1357 |
super().v2_playbook_on_no_hosts_remaining() |
| 1358 |
|
| 1359 |
def v2_playbook_on_task_start(self, task, is_conditional): |
| 1360 |
self._diy_task = task |
| 1361 |
|
| 1362 |
self._diy_spec = self._get_output_specification( |
| 1363 |
loader=self._diy_loader, |
| 1364 |
variables=self._get_vars(playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task), |
| 1365 |
) |
| 1366 |
|
| 1367 |
if self._using_diy(spec=self._diy_spec): |
| 1368 |
self._output(spec=self._diy_spec) |
| 1369 |
|
| 1370 |
if self._parent_has_callback(): |
| 1371 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1372 |
super().v2_playbook_on_task_start(task, is_conditional) |
| 1373 |
|
| 1374 |
# not implemented as the call to this is not implemented yet |
| 1375 |
def v2_playbook_on_cleanup_task_start(self, task): |
| 1376 |
pass |
| 1377 |
|
| 1378 |
def v2_playbook_on_handler_task_start(self, task): |
| 1379 |
self._diy_task = task |
| 1380 |
|
| 1381 |
self._diy_spec = self._get_output_specification( |
| 1382 |
loader=self._diy_loader, |
| 1383 |
variables=self._get_vars(playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task), |
| 1384 |
) |
| 1385 |
|
| 1386 |
if self._using_diy(spec=self._diy_spec): |
| 1387 |
self._output(spec=self._diy_spec) |
| 1388 |
|
| 1389 |
if self._parent_has_callback(): |
| 1390 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1391 |
super().v2_playbook_on_handler_task_start(task) |
| 1392 |
|
| 1393 |
def v2_playbook_on_vars_prompt( |
| 1394 |
self, |
| 1395 |
varname, |
| 1396 |
private=True, |
| 1397 |
prompt=None, |
| 1398 |
encrypt=None, |
| 1399 |
confirm=False, |
| 1400 |
salt_size=None, |
| 1401 |
salt=None, |
| 1402 |
default=None, |
| 1403 |
unsafe=None, |
| 1404 |
): |
| 1405 |
self._diy_spec = self._get_output_specification(loader=self._diy_loader, variables=self._diy_spec["vars"]) |
| 1406 |
|
| 1407 |
if self._using_diy(spec=self._diy_spec): |
| 1408 |
self._output(spec=self._diy_spec) |
| 1409 |
|
| 1410 |
if self._parent_has_callback(): |
| 1411 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1412 |
super().v2_playbook_on_vars_prompt( |
| 1413 |
varname, private, prompt, encrypt, confirm, salt_size, salt, default, unsafe |
| 1414 |
) |
| 1415 |
|
| 1416 |
# not implemented as the call to this is not implemented yet |
| 1417 |
def v2_playbook_on_import_for_host(self, result, imported_file): |
| 1418 |
pass |
| 1419 |
|
| 1420 |
# not implemented as the call to this is not implemented yet |
| 1421 |
def v2_playbook_on_not_import_for_host(self, result, missing_file): |
| 1422 |
pass |
| 1423 |
|
| 1424 |
def v2_playbook_on_play_start(self, play): |
| 1425 |
self._diy_play = play |
| 1426 |
|
| 1427 |
self._diy_spec = self._get_output_specification( |
| 1428 |
loader=self._diy_loader, variables=self._get_vars(playbook=self._diy_playbook, play=self._diy_play) |
| 1429 |
) |
| 1430 |
|
| 1431 |
if self._using_diy(spec=self._diy_spec): |
| 1432 |
self._output(spec=self._diy_spec) |
| 1433 |
|
| 1434 |
if self._parent_has_callback(): |
| 1435 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1436 |
super().v2_playbook_on_play_start(play) |
| 1437 |
|
| 1438 |
def v2_playbook_on_stats(self, stats): |
| 1439 |
self._diy_stats = stats |
| 1440 |
|
| 1441 |
self._diy_spec = self._get_output_specification( |
| 1442 |
loader=self._diy_loader, |
| 1443 |
variables=self._get_vars(playbook=self._diy_playbook, play=self._diy_play, stats=self._diy_stats), |
| 1444 |
) |
| 1445 |
|
| 1446 |
if self._using_diy(spec=self._diy_spec): |
| 1447 |
self._output(spec=self._diy_spec) |
| 1448 |
|
| 1449 |
if self._parent_has_callback(): |
| 1450 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1451 |
super().v2_playbook_on_stats(stats) |
| 1452 |
|
| 1453 |
def v2_playbook_on_include(self, included_file): |
| 1454 |
self._diy_included_file = included_file |
| 1455 |
|
| 1456 |
self._diy_spec = self._get_output_specification( |
| 1457 |
loader=self._diy_loader, |
| 1458 |
variables=self._get_vars( |
| 1459 |
playbook=self._diy_playbook, |
| 1460 |
play=self._diy_play, |
| 1461 |
task=self._diy_included_file._task, |
| 1462 |
included_file=self._diy_included_file, |
| 1463 |
), |
| 1464 |
) |
| 1465 |
|
| 1466 |
if self._using_diy(spec=self._diy_spec): |
| 1467 |
self._output(spec=self._diy_spec) |
| 1468 |
|
| 1469 |
if self._parent_has_callback(): |
| 1470 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1471 |
super().v2_playbook_on_include(included_file) |
| 1472 |
|
| 1473 |
def v2_on_file_diff(self, result): |
| 1474 |
self._diy_spec = self._get_output_specification( |
| 1475 |
loader=self._diy_loader, |
| 1476 |
variables=self._get_vars( |
| 1477 |
playbook=self._diy_playbook, play=self._diy_play, task=self._diy_task, result=result |
| 1478 |
), |
| 1479 |
) |
| 1480 |
|
| 1481 |
if self._using_diy(spec=self._diy_spec): |
| 1482 |
self._output(spec=self._diy_spec) |
| 1483 |
|
| 1484 |
if self._parent_has_callback(): |
| 1485 |
with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): |
| 1486 |
super().v2_on_file_diff(result) |