From a787d631ec0b0132c9504eca0a71aaef3cb445da Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Mon, 18 Apr 2016 10:49:35 -0700 Subject: [PATCH] Deployment reports datetime DB insertion was fixed When MySQL is used as a database backend deployment notification reports could not be persisted due to the fact that MySQL could not store timezone offset of datetime.datetime. Change-Id: Iea3b7d8d37ac68f0ebdcdcf96471a0d18a29469f Closes-Bug: #1570933 --- murano/common/server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/murano/common/server.py b/murano/common/server.py index af5e21f3..12194858 100644 --- a/murano/common/server.py +++ b/murano/common/server.py @@ -20,6 +20,7 @@ import oslo_messaging as messaging from oslo_messaging import target from oslo_service import service from oslo_utils import timeutils +import pytz from sqlalchemy import desc from murano.common.helpers import token_sanitizer @@ -178,7 +179,8 @@ def report_notification(report): status = models.Status() if 'timestamp' in report: - report['created'] = timeutils.parse_isotime(report.pop('timestamp')) + dt = timeutils.parse_isotime(report.pop('timestamp')) + report['created'] = dt.astimezone(pytz.utc).replace(tzinfo=None) status.update(report) unit = session.get_session()