]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
cleanup openstack-common.conf and sync updated files
authorDavanum Srinivas <davanum@gmail.com>
Sun, 7 Jun 2015 14:10:18 +0000 (10:10 -0400)
committerDavanum Srinivas (dims) <davanum@gmail.com>
Fri, 19 Jun 2015 20:01:01 +0000 (20:01 +0000)
Periodic update of latest files from oslo-incubator

Change-Id: Ie7eb02e4e9277c18abfb438b6cf710e0aa426b15

neutron/openstack/common/cache/cache.py
neutron/openstack/common/eventlet_backdoor.py
neutron/openstack/common/fileutils.py
neutron/openstack/common/loopingcall.py
neutron/openstack/common/periodic_task.py
neutron/openstack/common/service.py
neutron/openstack/common/threadgroup.py
openstack-common.conf
tools/install_venv_common.py

index 6f346ed4af76946f01e7ad512002b73f10e9719c..32e6b454cc81c2aea046f48ddb21d91c6686b202 100644 (file)
@@ -39,7 +39,7 @@ from stevedore import driver
 
 
 def _get_oslo_configs():
-    """Returns the oslo.config options to register."""
+    """Returns the oslo config options to register."""
     # NOTE(flaper87): Oslo config should be
     # optional. Instead of doing try / except
     # at the top of this file, lets import cfg
index 11fddb6b22a6876d71ced7cd904fcbc8efb407c6..113500339eda9f60d4930e91f9ef018e5e9d9a7f 100644 (file)
@@ -143,7 +143,7 @@ def initialize_if_enabled():
     # listen().  In any case, pull the port number out here.
     port = sock.getsockname()[1]
     LOG.info(
-        _LI('Eventlet backdoor listening on %(port)s for process %(pid)d') %
+        _LI('Eventlet backdoor listening on %(port)s for process %(pid)d'),
         {'port': port, 'pid': os.getpid()}
     )
     eventlet.spawn_n(eventlet.backdoor.backdoor_server, sock,
index 9097c35d4595c79071dd65e056000c640952479e..1191ce8f461b5587a860890ef4287150ce112786 100644 (file)
@@ -61,7 +61,7 @@ def read_cached_file(filename, force_reload=False):
     cache_info = _FILE_CACHE.setdefault(filename, {})
 
     if not cache_info or mtime > cache_info.get('mtime', 0):
-        LOG.debug("Reloading cached file %s" % filename)
+        LOG.debug("Reloading cached file %s", filename)
         with open(filename) as fap:
             cache_info['data'] = fap.read()
         cache_info['mtime'] = mtime
index 2ef18191835d9b7da36f773020b877c9d8be274a..ab28ca1c8e7ff5109ebee8d81074cf16f5d81f19 100644 (file)
@@ -84,9 +84,9 @@ class FixedIntervalLoopingCall(LoopingCallBase):
                         break
                     delay = end - start - interval
                     if delay > 0:
-                        LOG.warn(_LW('task %(func_name)r run outlasted '
-                                     'interval by %(delay).2f sec'),
-                                 {'func_name': self.f, 'delay': delay})
+                        LOG.warning(_LW('task %(func_name)r run outlasted '
+                                        'interval by %(delay).2f sec'),
+                                    {'func_name': self.f, 'delay': delay})
                     greenthread.sleep(-delay if delay < 0 else 0)
             except LoopingCallDone as e:
                 self.stop()
index 8f8c7adae85a42924701d6b761ac6daf58e45997..633a1467116b8aba6419fc1d71cead8d88f24a9f 100644 (file)
@@ -222,11 +222,11 @@ class PeriodicTasks(object):
 
             try:
                 task(self, context)
-            except Exception as e:
+            except Exception:
                 if raise_on_error:
                     raise
-                LOG.exception(_LE("Error during %(full_task_name)s: %(e)s"),
-                              {"full_task_name": full_task_name, "e": e})
+                LOG.exception(_LE("Error during %(full_task_name)s"),
+                              {"full_task_name": full_task_name})
             time.sleep(0)
 
         return idle_for
index bffc4e79be1b3d4babf37a70aeec920d2cbd5f8b..b757c008e22af3de4934b29cbb2db8f6ab67350e 100644 (file)
@@ -18,6 +18,7 @@
 """Generic Node base class for all workers that run on hosts."""
 
 import errno
+import io
 import logging
 import os
 import random
@@ -25,14 +26,6 @@ import signal
 import sys
 import time
 
-try:
-    # Importing just the symbol here because the io module does not
-    # exist in Python 2.6.
-    from io import UnsupportedOperation  # noqa
-except ImportError:
-    # Python 2.6
-    UnsupportedOperation = None
-
 import eventlet
 from eventlet import event
 from oslo_config import cfg
@@ -59,15 +52,15 @@ def _is_daemon():
     # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics
     try:
         is_daemon = os.getpgrp() != os.tcgetpgrp(sys.stdout.fileno())
+    except io.UnsupportedOperation:
+        # Could not get the fileno for stdout, so we must be a daemon.
+        is_daemon = True
     except OSError as err:
         if err.errno == errno.ENOTTY:
             # Assume we are a daemon because there is no terminal.
             is_daemon = True
         else:
             raise
-    except UnsupportedOperation:
-        # Could not get the fileno for stdout, so we must be a daemon.
-        is_daemon = True
     return is_daemon
 
 
@@ -234,7 +227,7 @@ class ProcessLauncher(object):
     def _pipe_watcher(self):
         # This will block until the write end is closed when the parent
         # dies unexpectedly
-        self.readpipe.read()
+        self.readpipe.read(1)
 
         LOG.info(_LI('Parent process has died unexpectedly, exiting'))
 
@@ -242,15 +235,12 @@ class ProcessLauncher(object):
 
     def _child_process_handle_signal(self):
         # Setup child signal handlers differently
-        def _sigterm(*args):
-            signal.signal(signal.SIGTERM, signal.SIG_DFL)
-            raise SignalExit(signal.SIGTERM)
-
         def _sighup(*args):
             signal.signal(signal.SIGHUP, signal.SIG_DFL)
             raise SignalExit(signal.SIGHUP)
 
-        signal.signal(signal.SIGTERM, _sigterm)
+        # Parent signals with SIGTERM when it wants us to go away.
+        signal.signal(signal.SIGTERM, signal.SIG_DFL)
         if _sighup_supported():
             signal.signal(signal.SIGHUP, _sighup)
         # Block SIGINT and let the parent send us a SIGTERM
index ddd3cf1e673b1bf1e19595752bdc683e8a8d8387..a3f74cabda798580be8510b9982467c65ef87f7f 100644 (file)
@@ -17,6 +17,7 @@ import threading
 import eventlet
 from eventlet import greenpool
 
+from neutron.openstack.common._i18n import _LE
 from neutron.openstack.common import loopingcall
 
 
@@ -98,15 +99,15 @@ class ThreadGroup(object):
                 x.stop()
             except eventlet.greenlet.GreenletExit:
                 pass
-            except Exception as ex:
-                LOG.exception(ex)
+            except Exception:
+                LOG.exception(_LE('Error stopping thread.'))
 
     def stop_timers(self):
         for x in self.timers:
             try:
                 x.stop()
-            except Exception as ex:
-                LOG.exception(ex)
+            except Exception:
+                LOG.exception(_LE('Error stopping timer.'))
         self.timers = []
 
     def stop(self, graceful=False):
@@ -132,8 +133,8 @@ class ThreadGroup(object):
                 x.wait()
             except eventlet.greenlet.GreenletExit:
                 pass
-            except Exception as ex:
-                LOG.exception(ex)
+            except Exception:
+                LOG.exception(_LE('Error waiting on ThreadGroup.'))
         current = threading.current_thread()
 
         # Iterate over a copy of self.threads so thread_done doesn't
index 4d86f85ffc79dc5aa489d47a48949df1992d37b7..12270514017c3c3a37538efb49ad6daddb63e42a 100644 (file)
@@ -3,13 +3,15 @@
 module=cache
 module=eventlet_backdoor
 module=fileutils
-module=install_venv_common
+# The following module is not synchronized by update.sh script since it's
+# located in tools/ not neutron/openstack/common/. Left here to make it
+# explicit that we still ship code from incubator here
+#module=install_venv_common
 module=loopingcall
 module=periodic_task
 module=service
 module=systemd
 module=threadgroup
-module=uuidutils
 
 # The base module to hold the copy of openstack.common
 base=neutron
index 3e8c1e4a81fba70836291784aea1378426969ad3..e279159abbc91cee56c77e51173c81abe716912a 100644 (file)
@@ -112,12 +112,12 @@ class InstallVenv(object):
         print('Installing dependencies with pip (this can take a while)...')
 
         # First things first, make sure our venv has the latest pip and
-        # setuptools.
-        self.pip_install('pip>=1.3')
+        # setuptools and pbr
+        self.pip_install('pip>=1.4')
         self.pip_install('setuptools')
+        self.pip_install('pbr')
 
-        self.pip_install('-r', self.requirements)
-        self.pip_install('-r', self.test_requirements)
+        self.pip_install('-r', self.requirements, '-r', self.test_requirements)
 
     def parse_args(self, argv):
         """Parses command-line arguments."""
@@ -125,7 +125,7 @@ class InstallVenv(object):
         parser.add_option('-n', '--no-site-packages',
                           action='store_true',
                           help="Do not inherit packages from global Python "
-                               "install")
+                               "install.")
         return parser.parse_args(argv[1:])[0]