summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorYaguang Tang <heut2008@gmail.com>2012-06-30 02:13:05 +0800
committerYaguang Tang <heut2008@gmail.com>2012-07-18 11:40:09 +0800
commitd5f2152dcfc4039de8324bdf75f6a2cd844dbdd0 (patch)
tree3614b8d9bfe55bdebddc700c06ffb8fc45e76e92 /openstack
parentace759e55d7c87dc66a500d598d1355dd3c0408f (diff)
downloadoslo-d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0.tar.gz
oslo-d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0.tar.xz
oslo-d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0.zip
fix bug lp:1019348,update openstack-common to support pep8 1.3.
also,this patch turns off pep8 E125 check. Change-Id: I22d2a94d89530586d614af39af17ae542c5e0cbf
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/log.py30
-rw-r--r--openstack/common/notifier/api.py16
-rw-r--r--openstack/common/notifier/list_notifier.py7
-rw-r--r--openstack/common/notifier/log_notifier.py4
-rw-r--r--openstack/common/notifier/rabbit_notifier.py6
-rw-r--r--openstack/common/rpc/impl_zmq.py2
-rw-r--r--openstack/common/version.py2
7 files changed, 34 insertions, 33 deletions
diff --git a/openstack/common/log.py b/openstack/common/log.py
index 9e0ad7e..8a368a1 100644
--- a/openstack/common/log.py
+++ b/openstack/common/log.py
@@ -66,13 +66,13 @@ log_opts = [
help='prefix each line of exception output with this format'),
cfg.ListOpt('default_log_levels',
default=[
- 'amqplib=WARN',
- 'sqlalchemy=WARN',
- 'boto=WARN',
- 'suds=INFO',
- 'keystone=INFO',
- 'eventlet.wsgi.server=WARN'
- ],
+ 'amqplib=WARN',
+ 'sqlalchemy=WARN',
+ 'boto=WARN',
+ 'suds=INFO',
+ 'keystone=INFO',
+ 'eventlet.wsgi.server=WARN'
+ ],
help='list of logger=LEVEL pairs'),
cfg.BoolOpt('publish_errors',
default=False,
@@ -89,7 +89,7 @@ log_opts = [
default='[instance: %(uuid)s] ',
help='If an instance UUID is passed with the log message, '
'format it like this'),
- ]
+]
generic_log_opts = [
@@ -105,7 +105,7 @@ generic_log_opts = [
cfg.StrOpt('logfile_mode',
default='0644',
help='Default file mode used when creating log files'),
- ]
+]
CONF = cfg.CONF
@@ -208,9 +208,9 @@ class JSONFormatter(logging.Formatter):
def formatException(self, ei, strip_newlines=True):
lines = traceback.format_exception(*ei)
if strip_newlines:
- lines = [itertools.ifilter(lambda x: x,
- line.rstrip().splitlines())
- for line in lines]
+ lines = [itertools.ifilter(
+ lambda x: x,
+ line.rstrip().splitlines()) for line in lines]
lines = list(itertools.chain(*lines))
return lines
@@ -252,9 +252,9 @@ class PublishErrorsHandler(logging.Handler):
CONF.list_notifier_drivers):
return
notifier.api.notify(None, 'error.publisher',
- 'error_notification',
- notifier.api.ERROR,
- dict(error=record.msg))
+ 'error_notification',
+ notifier.api.ERROR,
+ dict(error=record.msg))
def handle_exception(type, value, tb):
diff --git a/openstack/common/notifier/api.py b/openstack/common/notifier/api.py
index f01d11e..e699620 100644
--- a/openstack/common/notifier/api.py
+++ b/openstack/common/notifier/api.py
@@ -37,7 +37,7 @@ notifier_opts = [
cfg.StrOpt('default_publisher_id',
default='$host',
help='Default publisher_id for outgoing notifications'),
- ]
+]
CONF = cfg.CONF
CONF.register_opts(notifier_opts)
@@ -122,21 +122,21 @@ def notify(context, publisher_id, event_type, priority, payload):
"""
if priority not in log_levels:
raise BadPriorityException(
- _('%s not in valid priorities') % priority)
+ _('%s not in valid priorities') % priority)
# Ensure everything is JSON serializable.
payload = jsonutils.to_primitive(payload, convert_instances=True)
driver = importutils.import_module(CONF.notification_driver)
msg = dict(message_id=str(uuid.uuid4()),
- publisher_id=publisher_id,
- event_type=event_type,
- priority=priority,
- payload=payload,
- timestamp=str(timeutils.utcnow()))
+ publisher_id=publisher_id,
+ event_type=event_type,
+ priority=priority,
+ payload=payload,
+ timestamp=str(timeutils.utcnow()))
try:
driver.notify(context, msg)
except Exception, e:
LOG.exception(_("Problem '%(e)s' attempting to "
"send to notification system. Payload=%(payload)s") %
- locals())
+ locals())
diff --git a/openstack/common/notifier/list_notifier.py b/openstack/common/notifier/list_notifier.py
index 41549df..15ae470 100644
--- a/openstack/common/notifier/list_notifier.py
+++ b/openstack/common/notifier/list_notifier.py
@@ -19,9 +19,10 @@ from openstack.common import importutils
from openstack.common import log as logging
-list_notifier_drivers_opt = cfg.MultiStrOpt('list_notifier_drivers',
- default=['openstack.common.notifier.no_op_notifier'],
- help='List of drivers to send notifications')
+list_notifier_drivers_opt = cfg.MultiStrOpt(
+ 'list_notifier_drivers',
+ default=['openstack.common.notifier.no_op_notifier'],
+ help='List of drivers to send notifications')
CONF = cfg.CONF
CONF.register_opt(list_notifier_drivers_opt)
diff --git a/openstack/common/notifier/log_notifier.py b/openstack/common/notifier/log_notifier.py
index 9ef3118..b333d7a 100644
--- a/openstack/common/notifier/log_notifier.py
+++ b/openstack/common/notifier/log_notifier.py
@@ -30,6 +30,6 @@ def notify(_context, message):
CONF.default_notification_level)
priority = priority.lower()
logger = logging.getLogger(
- 'openstack.common.notification.%s' %
- message['event_type'])
+ 'openstack.common.notification.%s' %
+ message['event_type'])
getattr(logger, priority)(jsonutils.dumps(message))
diff --git a/openstack/common/notifier/rabbit_notifier.py b/openstack/common/notifier/rabbit_notifier.py
index 69ca8bd..3a2ffee 100644
--- a/openstack/common/notifier/rabbit_notifier.py
+++ b/openstack/common/notifier/rabbit_notifier.py
@@ -22,9 +22,9 @@ from openstack.common import rpc
LOG = logging.getLogger(__name__)
-notification_topic_opt = cfg.ListOpt('notification_topics',
- default=['notifications', ],
- help='AMQP topic used for openstack notifications')
+notification_topic_opt = cfg.ListOpt(
+ 'notification_topics', default=['notifications', ],
+ help='AMQP topic used for openstack notifications')
CONF = cfg.CONF
CONF.register_opt(notification_topic_opt)
diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py
index ba54cfa..4438155 100644
--- a/openstack/common/rpc/impl_zmq.py
+++ b/openstack/common/rpc/impl_zmq.py
@@ -52,7 +52,7 @@ zmq_opts = [
default=('openstack.common.rpc.'
'matchmaker.MatchMakerLocalhost'),
help='MatchMaker driver',
- ),
+ ),
# The following port is unassigned by IANA as of 2012-05-21
cfg.IntOpt('rpc_zmq_port', default=9501,
diff --git a/openstack/common/version.py b/openstack/common/version.py
index ca350ed..86de0c6 100644
--- a/openstack/common/version.py
+++ b/openstack/common/version.py
@@ -107,7 +107,7 @@ class VersionInfo(object):
versioninfo = "%s/versioninfo" % self.package
try:
raw_version = pkg_resources.resource_string(requirement,
- versioninfo)
+ versioninfo)
self.version = self._newer_version(raw_version.strip())
except (IOError, pkg_resources.DistributionNotFound):
self.version = self._generate_version()