mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 14:29:10 -07:00
parent
1b8e6bc95b
commit
524d5883b8
19 changed files with 142 additions and 64 deletions
|
@ -99,7 +99,6 @@ from ansible import context
|
|||
import socket
|
||||
import uuid
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
import logstash
|
||||
|
@ -109,6 +108,10 @@ except ImportError:
|
|||
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.datetime import (
|
||||
now,
|
||||
)
|
||||
|
||||
|
||||
class CallbackModule(CallbackBase):
|
||||
|
||||
|
@ -126,7 +129,7 @@ class CallbackModule(CallbackBase):
|
|||
"pip install python-logstash for Python 2"
|
||||
"pip install python3-logstash for Python 3")
|
||||
|
||||
self.start_time = datetime.utcnow()
|
||||
self.start_time = now()
|
||||
|
||||
def _init_plugin(self):
|
||||
if not self.disabled:
|
||||
|
@ -185,7 +188,7 @@ class CallbackModule(CallbackBase):
|
|||
self.logger.info("ansible start", extra=data)
|
||||
|
||||
def v2_playbook_on_stats(self, stats):
|
||||
end_time = datetime.utcnow()
|
||||
end_time = now()
|
||||
runtime = end_time - self.start_time
|
||||
summarize_stat = {}
|
||||
for host in stats.processed.keys():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue