]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
sync Oslo Grizzly stable branch with Quantum
authorMark McClain <mark.mcclain@dreamhost.com>
Wed, 13 Mar 2013 15:07:10 +0000 (11:07 -0400)
committerMark McClain <mark.mcclain@dreamhost.com>
Wed, 13 Mar 2013 15:07:10 +0000 (11:07 -0400)
fixes bug 1154393

Change-Id: I3442ff3da05447926b3e5882299ec7a92b9e38e3

25 files changed:
quantum/openstack/common/context.py
quantum/openstack/common/exception.py
quantum/openstack/common/excutils.py
quantum/openstack/common/fileutils.py
quantum/openstack/common/importutils.py
quantum/openstack/common/local.py
quantum/openstack/common/lockutils.py
quantum/openstack/common/log.py
quantum/openstack/common/network_utils.py
quantum/openstack/common/notifier/__init__.py
quantum/openstack/common/notifier/api.py
quantum/openstack/common/notifier/log_notifier.py
quantum/openstack/common/notifier/no_op_notifier.py
quantum/openstack/common/notifier/rpc_notifier.py
quantum/openstack/common/notifier/rpc_notifier2.py
quantum/openstack/common/notifier/test_notifier.py
quantum/openstack/common/processutils.py
quantum/openstack/common/rpc/amqp.py
quantum/openstack/common/rpc/impl_fake.py
quantum/openstack/common/rpc/impl_kombu.py
quantum/openstack/common/rpc/impl_qpid.py
quantum/openstack/common/rpc/impl_zmq.py
quantum/openstack/common/setup.py
quantum/openstack/common/timeutils.py
quantum/openstack/common/version.py

index 442ab1d8e2b482882576aac48b1cd852688244ad..e9cfd73cc110a1d67ff18cb6e1cf12f481c3f063 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 09c4d00a4f3b6a0cb4fe9fc668cdae3c6a776cf1..975a53a69211665667b0cc0869fa99da52a81bf9 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 6f6a81a0b9c2ee9ebd83ba20fcd858f849235515..d7fe150f0c9c8770feb4e6588b1d434431f6e34e 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # Copyright 2012, Red Hat, Inc.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 4746ad4981417bbb0f9eb5727b2d38398bc5fff8..b988ad03d5c94ae7ead50051a2f6609032fac2aa 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 9dec764fb4097bf5860c562a514baec88571fe79..3bd277f47e2d4fc503c4b17f9f9b6b6c18473d41 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 8bdc837a911d25d0849120c972e0c1124e63b0cd..f1bfc824bf6103c18f357c0dbcf57da9a76e4551 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 973607e2002c86021779b810a68f8fd0d27aef90..79639e0c3ac881c1e86f166a5e2bd079664ca323 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -107,10 +107,10 @@ class _InterProcessLock(object):
 
 class _WindowsLock(_InterProcessLock):
     def trylock(self):
-        msvcrt.locking(self.lockfile, msvcrt.LK_NBLCK, 1)
+        msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_NBLCK, 1)
 
     def unlock(self):
-        msvcrt.locking(self.lockfile, msvcrt.LK_UNLCK, 1)
+        msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_UNLCK, 1)
 
 
 class _PosixLock(_InterProcessLock):
index 37245d4da56b1e4128821f92f6533718d116c240..873672acdb8cb903545ac8ab305cd94f6073ec4c 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # Copyright 2010 United States Government as represented by the
 # Administrator of the National Aeronautics and Space Administration.
 # All Rights Reserved.
@@ -328,7 +328,7 @@ def setup(product_name):
     if CONF.log_config:
         logging.config.fileConfig(CONF.log_config)
     else:
-        _setup_logging_from_conf(product_name)
+        _setup_logging_from_conf()
     sys.excepthook = _create_logging_excepthook(product_name)
 
 
@@ -362,8 +362,8 @@ def _find_facility_from_conf():
     return facility
 
 
-def _setup_logging_from_conf(product_name):
-    log_root = getLogger(product_name).logger
+def _setup_logging_from_conf():
+    log_root = getLogger(None).logger
     for handler in log_root.handlers:
         log_root.removeHandler(handler)
 
@@ -401,7 +401,8 @@ def _setup_logging_from_conf(product_name):
         if CONF.log_format:
             handler.setFormatter(logging.Formatter(fmt=CONF.log_format,
                                                    datefmt=datefmt))
-        handler.setFormatter(LegacyFormatter(datefmt=datefmt))
+        else:
+            handler.setFormatter(LegacyFormatter(datefmt=datefmt))
 
     if CONF.debug:
         log_root.setLevel(logging.DEBUG)
index 69f67321636c571d2c28b6a4f3cbd32e2f1901a8..5224e01aa9495faac90a3074b1677a4ebb430f79 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2012 OpenStack LLC.
+# Copyright 2012 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 482d54e4fdd3d796e779c26331ce834846463163..45c3b46ae93ba49d1f4f665a1a26dfa5aec94eed 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 13cfea2e251223545afb5c497c788374285e8d66..5af9f9a2d2969e0bbe0a6458040e5c47cc5a645f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index cea98311c490460abf103acb6ff83ef4650e1980..99d9fa1c41e76fb5ca0b8fe9b40d1e947a9048de 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index ee1ddbdcac3a07b25036d0d7725df35c86715c31..bc7a56ca7ac0209c97dc9a1b83255b6850dcb77b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index e7caa97e28d2ed5adeec768849300829dbb336ec..c3a59e3a49ee127badeda6491f21aac04bb17a7e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 6d725f0160a8d149d081f5915d329022f1cfdf5f..860d92a356f32fb13b16c64b70cba0d9e0332703 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 5e348803dc140625cfcbf13d8eea1654cbd8d2b3..96c1746bf42a175e3285a51f6751921eef7eb449 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 12ef558a42ea0d4f610a83eb436334f1369bb9ab..9287cad94fb16826354c28246821b92786e87653 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index d648c4fc3d679525c1ad82d95bc40e7c7e463c6e..dbfc790c688e50ac54e9b913497a600dcfa4c6bf 100644 (file)
@@ -443,9 +443,11 @@ class ProxyCallback(_ThreadPoolWithWait):
                        connection_pool=self.connection_pool,
                        log_failure=False)
         except Exception:
-            LOG.exception(_('Exception during message handling'))
-            ctxt.reply(None, sys.exc_info(),
-                       connection_pool=self.connection_pool)
+            # sys.exc_info() is deleted by LOG.exception().
+            exc_info = sys.exc_info()
+            LOG.error(_('Exception during message handling'),
+                      exc_info=exc_info)
+            ctxt.reply(None, exc_info, connection_pool=self.connection_pool)
 
 
 class MulticallProxyWaiter(object):
index 779d2445293806fa67e0b938aea3bad7984962a7..7274802810cac263ee22627aac834e9b913d7137 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-#    Copyright 2011 OpenStack LLC
+#    Copyright 2011 OpenStack Foundation
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
 #    not use this file except in compliance with the License. You may obtain
index cbc92bdec30793f0f7fe0cb371cf11260abda0bd..a410232dd3407441cdec199da1d6bdcf9f23244c 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-#    Copyright 2011 OpenStack LLC
+#    Copyright 2011 OpenStack Foundation
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
 #    not use this file except in compliance with the License. You may obtain
index db165bceb98ca0f3a21ce1f7a0a78abbc88ac09c..7d3ed441ad196556013fbd090149671013fa6261 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-#    Copyright 2011 OpenStack LLC
+#    Copyright 2011 OpenStack Foundation
 #    Copyright 2011 - 2012, Red Hat, Inc.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index dc8a5e8675d12997ec963ee67870b7e744dad5ed..b1690789d629d544a069ec9c7c8fd95d4aa8fe51 100644 (file)
@@ -16,6 +16,7 @@
 
 import os
 import pprint
+import re
 import socket
 import sys
 import types
@@ -431,6 +432,8 @@ class ZmqProxy(ZmqBaseReactor):
 
     def __init__(self, conf):
         super(ZmqProxy, self).__init__(conf)
+        pathsep = set((os.path.sep or '', os.path.altsep or '', '/', '\\'))
+        self.badchars = re.compile(r'[%s]' % re.escape(''.join(pathsep)))
 
         self.topic_proxy = {}
 
@@ -456,6 +459,13 @@ class ZmqProxy(ZmqBaseReactor):
                 LOG.info(_("Creating proxy for topic: %s"), topic)
 
                 try:
+                    # The topic is received over the network,
+                    # don't trust this input.
+                    if self.badchars.search(topic) is not None:
+                        emsg = _("Topic contained dangerous characters.")
+                        LOG.warn(emsg)
+                        raise RPCException(emsg)
+
                     out_sock = ZmqSocket("ipc://%s/zmq_topic_%s" %
                                          (ipc_dir, topic),
                                          sock_type, bind=True)
index d0a3e948c44b7866badb77e699f311f8106dfe70..030df61c99420bfbe02ff6db3bb0585d9b239d21 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
 # All Rights Reserved.
 #
index 8e40660f6ac1aacc9eddadd10a1c1f4cd81df9db..60943659076765f0f4838f476239262041a87b22 100644 (file)
@@ -1,6 +1,6 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
-# Copyright 2011 OpenStack LLC.
+# Copyright 2011 OpenStack Foundation.
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
index 3a38c584a352884b2bd1144c821e8e531bcc4dfa..89082e4d6da25022910b8215eed6869bae28dd33 100644 (file)
@@ -1,5 +1,5 @@
 
-#    Copyright 2012 OpenStack LLC
+#    Copyright 2012 OpenStack Foundation
 #    Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may