diff options
Diffstat (limited to 'openstack/common')
-rw-r--r-- | openstack/common/eventlet_backdoor.py | 2 | ||||
-rw-r--r-- | openstack/common/notifier/api.py | 6 | ||||
-rw-r--r-- | openstack/common/policy.py | 5 | ||||
-rw-r--r-- | openstack/common/rpc/impl_kombu.py | 16 | ||||
-rw-r--r-- | openstack/common/rpc/impl_qpid.py | 13 | ||||
-rw-r--r-- | openstack/common/timeutils.py | 10 |
6 files changed, 32 insertions, 20 deletions
diff --git a/openstack/common/eventlet_backdoor.py b/openstack/common/eventlet_backdoor.py index 9f1404a..a86d24c 100644 --- a/openstack/common/eventlet_backdoor.py +++ b/openstack/common/eventlet_backdoor.py @@ -31,7 +31,7 @@ eventlet_backdoor_opts = [ cfg.IntOpt('backdoor_port', default=None, help='port for eventlet backdoor to listen') - ] +] CONF = cfg.CONF CONF.register_opts(eventlet_backdoor_opts) diff --git a/openstack/common/notifier/api.py b/openstack/common/notifier/api.py index c22e06c..470eacb 100644 --- a/openstack/common/notifier/api.py +++ b/openstack/common/notifier/api.py @@ -139,8 +139,8 @@ def notify(context, publisher_id, event_type, priority, payload): driver.notify(context, msg) except Exception, e: LOG.exception(_("Problem '%(e)s' attempting to " - "send to notification system. Payload=%(payload)s") % - locals()) + "send to notification system. " + "Payload=%(payload)s") % locals()) _drivers = None @@ -169,7 +169,7 @@ def add_driver(notification_driver): except ImportError as e: LOG.exception(_("Failed to load notifier %s. " "These notifications will not be sent.") % - notification_driver) + notification_driver) else: # Driver is already loaded; just add the object. _drivers[notification_driver] = notification_driver diff --git a/openstack/common/policy.py b/openstack/common/policy.py index 4cd5a43..a4064cf 100644 --- a/openstack/common/policy.py +++ b/openstack/common/policy.py @@ -172,8 +172,9 @@ class Brain(object): else: LOG.warning(_("Inheritance-based rules are deprecated; update " "_check_%s") % match_kind) - func = (lambda brain, kind, value, target, cred: - old_func(value, target, cred)) + func = lambda brain, kind, value, target, cred: old_func(value, + target, + cred) if not func: LOG.error(_("No handler for matches of kind %s") % match_kind) diff --git a/openstack/common/rpc/impl_kombu.py b/openstack/common/rpc/impl_kombu.py index 294fc0a..8617bfc 100644 --- a/openstack/common/rpc/impl_kombu.py +++ b/openstack/common/rpc/impl_kombu.py @@ -210,10 +210,11 @@ class TopicConsumer(ConsumerBase): 'auto_delete': False, 'exclusive': False} options.update(kwargs) - exchange = kombu.entity.Exchange( - name=rpc_amqp.get_control_exchange(conf), - type='topic', durable=options['durable'], - auto_delete=options['auto_delete']) + exchange_name = rpc_amqp.get_control_exchange(conf) + exchange = kombu.entity.Exchange(name=exchange_name, + type='topic', + durable=options['durable'], + auto_delete=options['auto_delete']) super(TopicConsumer, self).__init__(channel, callback, tag, @@ -307,9 +308,12 @@ class TopicPublisher(Publisher): 'auto_delete': False, 'exclusive': False} options.update(kwargs) + exchange_name = rpc_amqp.get_control_exchange(conf) super(TopicPublisher, self).__init__(channel, - rpc_amqp.get_control_exchange(conf), topic, - type='topic', **options) + exchange_name, + topic, + type='topic', + **options) class FanoutPublisher(Publisher): diff --git a/openstack/common/rpc/impl_qpid.py b/openstack/common/rpc/impl_qpid.py index 93d771c..1b3031c 100644 --- a/openstack/common/rpc/impl_qpid.py +++ b/openstack/common/rpc/impl_qpid.py @@ -180,9 +180,10 @@ class TopicConsumer(ConsumerBase): :param name: optional queue name, defaults to topic """ + exchange_name = rpc_amqp.get_control_exchange(conf) super(TopicConsumer, self).__init__(session, callback, - "%s/%s" % (rpc_amqp.get_control_exchange(conf), topic), - {}, name or topic, {}) + "%s/%s" % (exchange_name, topic), + {}, name or topic, {}) class FanoutConsumer(ConsumerBase): @@ -255,8 +256,9 @@ class TopicPublisher(Publisher): def __init__(self, conf, session, topic): """init a 'topic' publisher. """ + exchange_name = rpc_amqp.get_control_exchange(conf) super(TopicPublisher, self).__init__(session, - "%s/%s" % (rpc_amqp.get_control_exchange(conf), topic)) + "%s/%s" % (exchange_name, topic)) class FanoutPublisher(Publisher): @@ -274,9 +276,10 @@ class NotifyPublisher(Publisher): def __init__(self, conf, session, topic): """init a 'topic' publisher. """ + exchange_name = rpc_amqp.get_control_exchange(conf) super(NotifyPublisher, self).__init__(session, - "%s/%s" % (rpc_amqp.get_control_exchange(conf), topic), - {"durable": True}) + "%s/%s" % (exchange_name, topic), + {"durable": True}) class Connection(object): diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py index c4f6cf0..9901a4c 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -121,6 +121,10 @@ def marshall_now(now=None): def unmarshall_time(tyme): """Unmarshall a datetime dict.""" - return datetime.datetime(day=tyme['day'], month=tyme['month'], - year=tyme['year'], hour=tyme['hour'], minute=tyme['minute'], - second=tyme['second'], microsecond=tyme['microsecond']) + return datetime.datetime(day=tyme['day'], + month=tyme['month'], + year=tyme['year'], + hour=tyme['hour'], + minute=tyme['minute'], + second=tyme['second'], + microsecond=tyme['microsecond']) |