mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07:00
feat: implement timestamp callback plugin to show simple timestamp for each header (#8308)
* feat: add community.general.timestamp callback plugin * feat: add minimal integration tests for timestamp callback plugin * feat: add maintainers for timestamp callback plugin * fix: correct license * fix: remove type annotation for the older python environment * fix: remove unnecessary comment Co-authored-by: Felix Fontein <felix@fontein.de> * fix: add trailing period Co-authored-by: Felix Fontein <felix@fontein.de> * fix: split long description into list Co-authored-by: Felix Fontein <felix@fontein.de> * fix: remove default and add type Co-authored-by: Felix Fontein <felix@fontein.de> * fix; add type Co-authored-by: Felix Fontein <felix@fontein.de> * fix: split long description into list Co-authored-by: Felix Fontein <felix@fontein.de> * fix: improve description for format_string to describe usable format codes * fix: clarify the original codes and add copyright from that * fix: shorten long lines * fix: correct link format * fix: add seealso section * fix: add ignore entries for EOL CI * fix: update seealso to correctly associate with related plugin Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
cd01a928ab
commit
bb73f28bf5
6 changed files with 203 additions and 0 deletions
6
tests/integration/targets/callback_timestamp/aliases
Normal file
6
tests/integration/targets/callback_timestamp/aliases
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2024, kurokobo <kurokobo@protonmail.com>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or <https://www.gnu.org/licenses/gpl-3.0.txt>)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
azp/posix/1
|
||||
needs/target/callback
|
66
tests/integration/targets/callback_timestamp/tasks/main.yml
Normal file
66
tests/integration/targets/callback_timestamp/tasks/main.yml
Normal file
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
# Copyright (c) 2024, kurokobo <kurokobo@protonmail.com>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Run tests
|
||||
include_role:
|
||||
name: callback
|
||||
vars:
|
||||
tests:
|
||||
- name: Enable timestamp in the default length
|
||||
environment:
|
||||
ANSIBLE_NOCOLOR: 'true'
|
||||
ANSIBLE_FORCE_COLOR: 'false'
|
||||
ANSIBLE_STDOUT_CALLBACK: community.general.timestamp
|
||||
ANSIBLE_CALLBACK_TIMESTAMP_FORMAT_STRING: "15:04:05"
|
||||
playbook: |
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Sample task name
|
||||
debug:
|
||||
msg: sample debug msg
|
||||
expected_output: [
|
||||
"",
|
||||
"PLAY [testhost] ******************************************************* 15:04:05",
|
||||
"",
|
||||
"TASK [Sample task name] *********************************************** 15:04:05",
|
||||
"ok: [testhost] => {",
|
||||
" \"msg\": \"sample debug msg\"",
|
||||
"}",
|
||||
"",
|
||||
"PLAY RECAP ************************************************************ 15:04:05",
|
||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||
]
|
||||
|
||||
- name: Enable timestamp in the longer length
|
||||
environment:
|
||||
ANSIBLE_NOCOLOR: 'true'
|
||||
ANSIBLE_FORCE_COLOR: 'false'
|
||||
ANSIBLE_STDOUT_CALLBACK: community.general.timestamp
|
||||
ANSIBLE_CALLBACK_TIMESTAMP_FORMAT_STRING: "2006-01-02T15:04:05"
|
||||
playbook: |
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Sample task name
|
||||
debug:
|
||||
msg: sample debug msg
|
||||
expected_output: [
|
||||
"",
|
||||
"PLAY [testhost] ******************************************** 2006-01-02T15:04:05",
|
||||
"",
|
||||
"TASK [Sample task name] ************************************ 2006-01-02T15:04:05",
|
||||
"ok: [testhost] => {",
|
||||
" \"msg\": \"sample debug msg\"",
|
||||
"}",
|
||||
"",
|
||||
"PLAY RECAP ************************************************* 2006-01-02T15:04:05",
|
||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue