summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/general/plugins/callback/logstash.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 04:06:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 04:06:02 +0000
commite3eb94c23206603103f3c4faec6c227f59a1544c (patch)
treef2639459807ba88f55fc9c54d745bd7075d7f15c /ansible_collections/community/general/plugins/callback/logstash.py
parentReleasing progress-linux version 9.4.0+dfsg-1~progress7.99u1. (diff)
downloadansible-e3eb94c23206603103f3c4faec6c227f59a1544c.tar.xz
ansible-e3eb94c23206603103f3c4faec6c227f59a1544c.zip
Merging upstream version 9.5.1+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/community/general/plugins/callback/logstash.py')
-rw-r--r--ansible_collections/community/general/plugins/callback/logstash.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/ansible_collections/community/general/plugins/callback/logstash.py b/ansible_collections/community/general/plugins/callback/logstash.py
index 144e1f991..f3725e465 100644
--- a/ansible_collections/community/general/plugins/callback/logstash.py
+++ b/ansible_collections/community/general/plugins/callback/logstash.py
@@ -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():