]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Stop use of oslo_utils.timeutils.strtime()
authorfumihiko kakuma <kakuma@valinux.co.jp>
Mon, 13 Jul 2015 05:53:42 +0000 (14:53 +0900)
committerfumihiko kakuma <kakuma@valinux.co.jp>
Mon, 20 Jul 2015 20:06:11 +0000 (20:06 +0000)
oslo_utils.timeutils.strtime() is deprecated in version '1.6'.
We use datetime.datetime.isoformat() or datetime.datetime.strftime()
instead.

Change-Id: Id6e8645362fe70b1427d45d5b44048fe47aba0f7
Closes-Bug: #1475156

neutron/agent/rpc.py
neutron/tests/fullstack/fullstack_fixtures.py
neutron/tests/unit/extensions/test_agent.py

index 11bf79784c519417d505c0413159375135f045a9..38fa4de127496aa7f0494985444a029c75b43449 100644 (file)
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from datetime import datetime
 import itertools
 
 from oslo_log import log as logging
 import oslo_messaging
-from oslo_utils import timeutils
 from oslo_utils import uuidutils
 
 from neutron.common import constants
@@ -80,7 +80,7 @@ class PluginReportStateAPI(object):
         agent_state['uuid'] = uuidutils.generate_uuid()
         kwargs = {
             'agent_state': {'agent_state': agent_state},
-            'time': timeutils.strtime(),
+            'time': datetime.utcnow().isoformat(),
         }
         method = cctxt.call if use_call else cctxt.cast
         return method(context, 'report_state', **kwargs)
index 690891cd550ea9a3d5d28dd27983fb0f96149622..ed7e87f5ef76a148ceab1aaa46d889f9b6d0cdcd 100644 (file)
@@ -12,6 +12,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from datetime import datetime
 from distutils import spawn
 import functools
 import os
@@ -21,7 +22,6 @@ from neutronclient.common import exceptions as nc_exc
 from neutronclient.v2_0 import client
 from oslo_config import cfg
 from oslo_log import log as logging
-from oslo_utils import timeutils
 
 from neutron.agent.linux import async_process
 from neutron.agent.linux import utils
@@ -55,7 +55,7 @@ class ProcessFixture(fixtures.Fixture):
 
         cmd = [spawn.find_executable(self.exec_name),
                '--log-dir', log_dir,
-               '--log-file', timeutils.strtime(fmt=fmt)]
+               '--log-file', datetime.utcnow().strftime(fmt)]
         for filename in self.config_filenames:
             cmd += ['--config-file', filename]
         self.process = async_process.AsyncProcess(cmd)
index ff805b469e3aa8e3d3f638fd8af2dc96808721af..546b18467f0350789e1616adc0a4989b5c3f39cd 100644 (file)
 #    under the License.
 
 import copy
+from datetime import datetime
 import time
 
 from oslo_config import cfg
 from oslo_log import log as logging
-from oslo_utils import timeutils
 from oslo_utils import uuidutils
 from webob import exc
 
@@ -108,10 +108,10 @@ class AgentDBTestMixIn(object):
             callback = agents_db.AgentExtRpcCallback()
             callback.report_state(self.adminContext,
                                   agent_state={'agent_state': lbaas_hosta},
-                                  time=timeutils.strtime())
+                                  time=datetime.utcnow().isoformat())
             callback.report_state(self.adminContext,
                                   agent_state={'agent_state': lbaas_hostb},
-                                  time=timeutils.strtime())
+                                  time=datetime.utcnow().isoformat())
             res += [lbaas_hosta, lbaas_hostb]
 
         return res