From 690bdce9a73ec6d00b4eebbbca31cc527e7b2fce Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 6 May 2016 12:19:24 -0500 Subject: fix timestamp in reporting events. If no timestamp was passed into a ReportingEvent, then the default was used. That default was 'time.time()' which was evaluated once only at import time. --- cloudinit/reporting/events.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cloudinit/reporting/events.py') diff --git a/cloudinit/reporting/events.py b/cloudinit/reporting/events.py index 2f767f64..df2b9b4a 100644 --- a/cloudinit/reporting/events.py +++ b/cloudinit/reporting/events.py @@ -33,11 +33,13 @@ class ReportingEvent(object): """Encapsulation of event formatting.""" def __init__(self, event_type, name, description, - origin=DEFAULT_EVENT_ORIGIN, timestamp=time.time()): + origin=DEFAULT_EVENT_ORIGIN, timestamp=None): self.event_type = event_type self.name = name self.description = description self.origin = origin + if timestamp is None: + timestamp = time.time() self.timestamp = timestamp def as_string(self): -- cgit v1.2.3