summaryrefslogtreecommitdiff
path: root/cloudinit/reporting
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-05-06 12:19:24 -0500
committerScott Moser <smoser@ubuntu.com>2016-05-06 12:19:24 -0500
commit690bdce9a73ec6d00b4eebbbca31cc527e7b2fce (patch)
tree780cb3f979fdb20b8db6eba8a95ea29d4c23c691 /cloudinit/reporting
parent0780b3abfb14e8994f6097c5d1d22a92e91bc2f5 (diff)
downloadvyos-cloud-init-690bdce9a73ec6d00b4eebbbca31cc527e7b2fce.tar.gz
vyos-cloud-init-690bdce9a73ec6d00b4eebbbca31cc527e7b2fce.zip
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.
Diffstat (limited to 'cloudinit/reporting')
-rw-r--r--cloudinit/reporting/events.py4
1 files changed, 3 insertions, 1 deletions
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):