From 72687f5637837f6e57a35d8dd74cc28b95fb456c Mon Sep 17 00:00:00 2001 From: gordon chung Date: Wed, 20 Apr 2016 08:29:49 -0400 Subject: [PATCH] use static timestamps for api samples Building ceilometer cannot be done in a reproducible manner, due to the use of timestamps. If you don't know about reproducible builds, please read on: https://wiki.debian.org/ReproducibleBuilds https://wiki.debian.org/ReproducibleBuilds/About This patch is a forward of the Debian bug patch sent here: https://bugs.debian.org/820179 Change-Id: Iddb746eaa03386b69f746f9ff2cef09e686ebd8b Closes-Bug: #1572432 --- ceilometer/api/controllers/v2/events.py | 2 +- ceilometer/api/controllers/v2/meters.py | 4 ++-- ceilometer/api/controllers/v2/resources.py | 2 +- ceilometer/api/controllers/v2/samples.py | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ceilometer/api/controllers/v2/events.py b/ceilometer/api/controllers/v2/events.py index bb2120c556..df81f756ef 100644 --- a/ceilometer/api/controllers/v2/events.py +++ b/ceilometer/api/controllers/v2/events.py @@ -143,7 +143,7 @@ class Event(base.Base): def sample(cls): return cls( event_type='compute.instance.update', - generated=datetime.datetime(2015, 1, 1, 12, 30, 59, 123456), + generated=datetime.datetime(2015, 1, 1, 12, 0, 0, 0), message_id='94834db1-8f1b-404d-b2ec-c35901f1b7f0', traits={ Trait(name='request_id', diff --git a/ceilometer/api/controllers/v2/meters.py b/ceilometer/api/controllers/v2/meters.py index 6bf60e726b..3ad5e0eae8 100644 --- a/ceilometer/api/controllers/v2/meters.py +++ b/ceilometer/api/controllers/v2/meters.py @@ -116,8 +116,8 @@ class OldSample(base.Base): resource_id='bd9431c1-8d69-4ad3-803a-8d4a6b89fd36', project_id='35b17138-b364-4e6a-a131-8f3099c5be68', user_id='efd87807-12d2-4b38-9c70-5f5c2ac427ff', - recorded_at=datetime.datetime.utcnow(), - timestamp=datetime.datetime.utcnow(), + recorded_at=datetime.datetime(2015, 1, 1, 12, 0, 0, 0), + timestamp=datetime.datetime(2015, 1, 1, 12, 0, 0, 0), resource_metadata={'name1': 'value1', 'name2': 'value2'}, message_id='5460acce-4fd6-480d-ab18-9735ec7b1996', diff --git a/ceilometer/api/controllers/v2/resources.py b/ceilometer/api/controllers/v2/resources.py index bfa2490ddb..b9918c21fa 100644 --- a/ceilometer/api/controllers/v2/resources.py +++ b/ceilometer/api/controllers/v2/resources.py @@ -71,7 +71,7 @@ class Resource(base.Base): resource_id='bd9431c1-8d69-4ad3-803a-8d4a6b89fd36', project_id='35b17138-b364-4e6a-a131-8f3099c5be68', user_id='efd87807-12d2-4b38-9c70-5f5c2ac427ff', - timestamp=datetime.datetime.utcnow(), + timestamp=datetime.datetime(2015, 1, 1, 12, 0, 0, 0), source="openstack", metadata={'name1': 'value1', 'name2': 'value2'}, diff --git a/ceilometer/api/controllers/v2/samples.py b/ceilometer/api/controllers/v2/samples.py index 198bb74e9c..05ded82feb 100644 --- a/ceilometer/api/controllers/v2/samples.py +++ b/ceilometer/api/controllers/v2/samples.py @@ -21,7 +21,6 @@ import datetime import uuid -from oslo_utils import timeutils import pecan from pecan import rest from wsme import types as wtypes @@ -99,8 +98,8 @@ class Sample(base.Base): resource_id='bd9431c1-8d69-4ad3-803a-8d4a6b89fd36', project_id='35b17138-b364-4e6a-a131-8f3099c5be68', user_id='efd87807-12d2-4b38-9c70-5f5c2ac427ff', - timestamp=timeutils.utcnow(), - recorded_at=datetime.datetime.utcnow(), + timestamp=datetime.datetime(2015, 1, 1, 12, 0, 0, 0), + recorded_at=datetime.datetime(2015, 1, 1, 12, 0, 0, 0), source='openstack', metadata={'name1': 'value1', 'name2': 'value2'},