]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Replaced deprecated isotime() function
authorBrandon Palm <bapalm@us.ibm.com>
Fri, 9 Oct 2015 13:52:58 +0000 (08:52 -0500)
committerBrandon Palm <bapalm@us.ibm.com>
Mon, 12 Oct 2015 13:16:33 +0000 (08:16 -0500)
The agents_db.py was using a deprecated function 'isotime()'.

I removed the deprecated function and replaced it with:
datetime.datetime.isoformat()

https://docs.python.org/2/library/datetime.html

Change-Id: I32b6096fb1a42caef529db0a71fa52f7de5706f5
Closes-Bug: #1504557

neutron/db/agents_db.py

index 324601629abfe8e3ea7828aa031b9bbed6fdbec2..2a9aeb734530e44bdec5c36f5308922229f7d71e 100644 (file)
@@ -13,6 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import datetime
+
 from eventlet import greenthread
 from oslo_config import cfg
 from oslo_db import exception as db_exc
@@ -371,8 +373,8 @@ class AgentExtRpcCallback(object):
         agent_state = kwargs['agent_state']['agent_state']
         self._check_clock_sync_on_agent_start(agent_state, time)
         if self.START_TIME > time:
-            time_agent = timeutils.isotime(time)
-            time_server = timeutils.isotime(self.START_TIME)
+            time_agent = datetime.datetime.isoformat(time)
+            time_server = datetime.datetime.isoformat(self.START_TIME)
             log_dict = {'agent_time': time_agent, 'server_time': time_server}
             LOG.debug("Stale message received with timestamp: %(agent_time)s. "
                       "Skipping processing because it's older than the "
@@ -393,13 +395,15 @@ class AgentExtRpcCallback(object):
             diff = abs(timeutils.delta_seconds(time_server_now, agent_time))
             if diff > cfg.CONF.agent_down_time:
                 agent_name = agent_state['agent_type']
-                time_agent = timeutils.isotime(agent_time)
+                time_agent = datetime.datetime.isoformat(agent_time)
+
                 host = agent_state['host']
                 log_dict = {'host': host,
                             'agent_name': agent_name,
                             'agent_time': time_agent,
                             'threshold': cfg.CONF.agent_down_time,
-                            'serv_time': timeutils.isotime(time_server_now),
+                            'serv_time': (datetime.datetime.isoformat
+                                          (time_server_now)),
                             'diff': diff}
                 LOG.error(_LE("Message received from the host: %(host)s "
                               "during the registration of %(agent_name)s has "